What is the total number of recursive calls/invocations to compute fib(8)…

TPSC Computer/IT Posts 2026

What is the total number of recursive calls/invocations to compute fib(8) using the function ?

int fib(int n){
    if (n == 1) return 1;
    else if(n == 2) return 1;
    else return(fib(n-1)+fib(n-2));
}
  1. A.

    13

  2. B.

    21

  3. C.

    30

  4. D.

    41

Attempted by 360 students.

Sign up free to check your answer

Sign up free

Explore the full course: Isro

Loading lesson…