Recursion in C Programming Exercise I


Ques 1 Recursion


A function which call itself is called _________ function.
  a) recursion
  b) recursive
  c) pointer
  d) function


b is the correct option

The answer is (b) recursive.
A function that calls itself is called a recursive function. The word "recursive" comes from the Latin word "recursus", which means "to run back". A recursive function is a function that calls itself to solve a problem. The function breaks the problem down into smaller and smaller subproblems until the subproblems become simple enough to be solved directly




Ques 2 Recursion


Recursive algorithm can be implemented without recursive function call using __________ data structure.
  a) Array
  b) Pointer
  c) Queue
  d) stack


d is the correct option




Ques 3 Recursion


Consider the following C function

int fun(int n,int *f_p)
{
    int t,f;
    if(n<=0)
    {
        *f_p=1;
        return 1;
    }
    t=fun(n-1,f_p);
    f=t+*f_p;
    *f_p=t;
    return f;
}
int main( )
{
    int x=15;
    printf("%d\n",fun(5,&x));
    return 0;
}

the value printed as?

  a) 6
  b) 8
  c) 14
  d) 51


b is the correct option