What is the value returned by the recursive function ackermann(2,3) ? C int…

2026

What is the value returned by the recursive function ackermann(2,3) ?

C

int ackermann(int i, int j){
    if(i == 0) return 2*j;
    else if (j == 1) return 2;
    else return ackermann(i-1, ackermann(i, j-1)) ;
}

Answer: A. 16

  1. A.

    16

  2. B.

    20

  3. C.

    25

  4. D.

    30

Attempted by 246 students.

Show answer & explanation

Correct answer: A

Explore the full course: Tpsc Assistant Technical Officer

Loading lesson…