Recursive Programs questions

Q40

GATE CS 2014 CS-2RecursionNAT2 marks
Consider the following function
double f(double x){
   if( abs(x*x - 3) < 0.01) return x;
   else return f(x/2 + 1.5/x);
}
Give a value q (to 2 decimals) such that f(q) will return q:_____.
Show answer without attempting

Answer: 1.72 to 1.74

Q42

GATE CS 2014 CS-2RecursionMCQ2 marks−2/3 if wrong
Consider the C function given below.
int f(int j)
{
  static int i = 50;
  int k;
  if (i == j)
     {
       printf("something");
       k = f(i);
       return 0;
     }
  else return 0;
}
Which one of the following is TRUE?
Show answer without attempting

Answer: D

0/20 correct0 marks