Flowchart: Alternate Process: SEPTEMBER 2010Time: 3 Hours Max. Marks: 100



      Question 1 is compulsory and carries 28 marks. Answer any FOUR questions from the rest. Marks are indicated against each question.

      Parts of a question should be answered at the same place.



Q.1 a. Write a recursive function to calculate factorial of an integer.

b. How is union different from a structure in C? Explain giving suitable examples.

c. Consider the following macro definition


                      #define root (a, b) sqrt((a) * (a) + (b) * (b))

           What will be the result of the following macro call statement?

                  root(a++, b++) if a = 3 and b = 4

d. What is the output of the following program segment?

                      sum = 0;

                      i = 1;

                      while(i <= 10)

                         sum += i++;

                         printf(%d, i);


e. Write a C function which returns the square of 3 integers sent by the main program.

f. Write a note on black box testing.

g. Write a C function to reverse the digits of an integer. (74)

Q.2 a. Write a program in C to sort a given list of numbers using any sorting method. (9)

b. Write a C function to delete a specified node from a singly linked list. (9)

Q.3 a. Write a C function to reverse a substring within the main string. Pointers to the main string and the substring are passed as arguments to this function. (10)

b. What are the output of following program segments?


(i) void swap (int a , int b );

void main ( )


int a, int b ;

a = 6;

b = 10;

swap (a ,b) ;

printf (a is % d, b is % d ,a ,b);


void swap (int a, int b )


int temp ;

temp = a ;

a = b;

b = temp ;


(ii) int solve (int a, int b, int r);

void main ( )


int x;

p = 8;

q = 15;

r = 6;

x = solve (p, q, r);

printf (x = % d, p = % d, q = % d, p, q, r);}

int solve (int a, int b, int r)


a = b+r;

return a;

b = b-r;

return b; (4+4)



Q.4 a. Write a C program to test whether given pair of numbers are amicable numbers.  (Amicable number are pairs of numbers each of whose divisors add to the other  number) (9)

b. Write a C program to calculate the standard deviation of an array of values. The array elements are read from the terminal. Use functions to calculate standard deviations and mean. (9)


Q.5 a. Write a C program that makes use of a nested macro that gives the minimum of three variables. (6)

b. Given a linked list P, containing even and odd integers, write a C function to return this list such that the list now contains only the even terms. (12)


Q.6 a. What is printed after execution of each of the following C-program? Give reasons.

(i) void main()


float reals[5];

*(reals+1) = 245.8;


printf(%f, reals[0]);


(ii) void main()


int nums[3];

int *ptr=nums;







(iii) void main()


int digit=0;




(iv) int fun1 (int c, int d);

void main()


int a=7,b=6;


printf(\n a is %d b is %d,a,b);


int fun1(int c, int d)


int e;



printf(:\n c is%d is %d e is %d,c,d,e);

} (12)


b. Write a program to convert a binary number to equivalent decimal number. (6)


Q.7 a. Write a program in C which prints the smallest divisor of an integer, other than one, for example smallest divisor of 77 is 7. (6)

b. Write a program to read two strings through the keyboard. Compare these two strings     character by character. Display the similar characters found in both the strings and     count the number of dissimilar characters. (6)

c. Write a program to evaluate the series given below for 50 terms.

Sum = x - (6)