Ask Question
28 August, 23:32

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. 29 August, 00:52
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers