Monthly Archives: June 2014

Summarize the purpose of the format strings (like %s, %d, %c) that are’ commonly used within the printf function, with an example for each.10m Jun2006

Summarize the purpose of the format strings (like %s, %d, %c) that are’ commonly used within the printf function, with an example for each.10m Jun2006 If printf function format includes format specifiers (subsequences beginning with %), the additional arguments following format are formatted and inserted in the resulting string replacing their respective specifiers. It can… Read More »

Design an algorithm, draw a corresponding flowchart and write a C program to check whether a given string is a palindrome or not. 10m Jun2006

Design an algorithm, draw a corresponding flowchart and write a C program to check whether a given string is a palindrome or not. 10m Jun2006 An algorithm is a finite set of steps defining the solution of a particular problem. An algorithm is expressed in pseudo code – something resembling C language or Pascal, but… Read More »

Explain the meaning of each of the following functions prototypes and mention the return data type of each of them: 10m Jun2006

Explain the meaning of each of the following functions prototypes and mention the return data type of each of them: 10m Jun2006   (i) double f(double a, int b);  –   This function has two arguments, first of double data type and second of int data type. The return data type is double.   (ii) void… Read More »

What is the difference between a function and a macro? Find the largest number among two numbers using a function definition as well as a macro. Which is more efficient in terms of execution time and code size? 10m Jun2006

What is the difference between a function and a macro? Find the largest number among two numbers using a function definition as well as a macro. Which is more efficient in terms of execution time and code size? 10m Jun2006  Difference between a function and a macro:    Function Code [codesyntax lang=”c”] int MAX(X,Y) {… Read More »

Write a program to sort a list of strings in alphabetical order, using an array of pointers. 10m Jun2006

Write a program to sort a list of strings in alphabetical order, using an array of pointers. 10m Jun2006 #include<stdio.h> void main() {     char *T;     int I,J,K;     char *ARRAY[5]={“SUNIL”,”ANIL”,”DILIP”,”JAY”,”BHARAT”};     clrscr();     for(I=0;I<5;I++)     {        printf(“%s \t”,ARRAY[I]);     }     printf(“\n”);     for(I=0;I<4;I++)     {       for(J=0;J<4-I;J++)       {  K=strcmp(ARRAY[J],ARRAY[J+1]);  if(K>0)… Read More »

Write a Menu driven program in C to add, subtract add multiply two distances which are given in feet and inches. 10m Dec2005

Write a Menu driven program in C to add, subtract add multiply two distances which are given in feet and inches. [e.g. 3 ft 9 inches + 2 ft 5 inches=6 ft 2 inches]. 10m Dec2005 #include<stdio.h> struct LENGTH {     int FEET;     int INCH; }; void main() {  int I;  struct LENGTH A,B;… Read More »

Write an algorithm and draw a corresponding flowchart to search a number in the given list of numbers and also display its position. 10m Dec2005

 Write an algorithm and draw a corresponding flowchart to search a number in the given list of numbers and also display its position. 10m Dec2005  An algorithm is a finite set of steps defining the solution of a particular problem. An algorithm is expressed in pseudo code – something resembling C language or Pascal, but… Read More »

Write a recursive program in ‘C’ to find whether a given five digit number is a palindrome or not. 10m Dec2005

Write a recursive program in ‘C’ to find whether a given five digit number is a palindrome or not. 10m Dec2005 #include<stdio.h> int flag=0; void palin(int,int*); void main() { int a; clrscr(); printf(“Enter the number “); scanf(“%d”,&a); palin(a,&a); if(flag==0) printf(“\nThe number is palindrome…”); else printf(“\nThe number is not palindrome…”); getch(); } void palin(int x,int* y)… Read More »

Write a program in ‘C’ to print automorphic numbers. The automorphic number is a number in which the square of the number contains the number in the end. 10m Dec2005

Write a program in ‘C’ to print automorphic numbers. The automorphic number is a number in which the square of the number contains the number in the end. Example: (a) 5; 25 (b) 6; 36. 10m Dec2005 #include<stdio.h> void main() {   int SQ,i,NUM;   clrscr();   printf(“AUTOMORPHIC NUMBERS BETWEEN 0 TO 999 ARE :… Read More »

Design an algorithm and draw corresponding flowchart to find all the prime numbers between two given numbers ‘m’ and ‘n’, where m, n > 0. 10m Dec2005

Design an algorithm and draw corresponding flowchart to find all the prime numbers between two given numbers ‘m’ and ‘n’, where m, n > 0. 10m Dec2005 An algorithm is a finite set of steps defining the solution of a particular problem. An algorithm is expressed in pseudo code – something resembling C language or… Read More »