December 1999
CA208 : 'C' PROGRAMMING

QUESTION 4

Total Marks: 15 Marks

Click here to access other questions

Click to access
SUGGESTED SOLUTIONS
for Question 4

(a)

Explain the difference between recursion and iteration.

 

[2]
(b)

In a recursive function,the recursive call should always be guarded by a test. Briely explain what would normally be tested for,and why it is necessary.

 

[2]
(c)

Give an example of a construct which is used to write an iterative loop.

 

[1]
(d)

Identify the difference between call by reference and call by value parameter passing.

 

[2]
(e)

The mathematical expression x y is computed by multiplying x by itself,y times.Write a recursive procedure,called power ,the signature of which is given below,which takes in an integer x and an integer y by reference,and on exit the value of x is x y .On exit the value of y should remain unchanged.

void power(int*x,int*y);

[8]