What is the likely result of calling the following recursive function with n equal to 5?

int fun(int n)
{
    if (n == 0)
        return 1;
    return fun(n + 1);
}
                        

Options

  • A. It returns 120
  • B. It returns 1 immediately
  • C. It keeps recursing without reaching the base case
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. It keeps recursing without reaching the base case

Detailed Explanation

Correct Answer: Option C

Explanation:
Starting at 5, the recursive calls use 6, 7, 8, and higher values. The condition n == 0 is never satisfied. The recursion is unbounded and may exhaust the call stack; the exact runtime behavior is not guaranteed.