Ask Question
8 November, 13:38

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.

+3
Answers (1)
  1. 8 November, 13:43
    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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers