Recursion in C MCQs Exercise I

Ques 1 Recursion


A function which call itself is called _________ function.

A recursion
B recursive
C pointer
D function

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

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