Ask Question
1 March, 19:54

Analyze the following recursive method.

public static long factorial (int n) {

return n * factorial (n - 1);

}

A. Invoking factorial (0) returns 0.

B. Invoking factorial (1) returns 1.

C. Invoking factorial (2) returns 2.

D. Invoking factorial (3) returns 6.

E. The method runs infinitely and causes a StackOverflowError.

+4
Answers (1)
  1. 1 March, 23:20
    0
    Answer: E

    Process is terminating due to StackOverflowException.

    Explanation:

    System. StackOverflowException

    HResult=0x800703E9

    Message=Exception of type 'System. StackOverflowException' was thrown.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Analyze the following recursive method. public static long factorial (int n) { return n * factorial (n - 1); } A. Invoking factorial (0) ...” in 📘 Engineering if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers