Solved

For the Questions Below, Refer to the Following Recursive Factorial

Question 26

Multiple Choice

For the questions below, refer to the following recursive factorial method.
public int factorial(int x)
{
if (x > 1) return x * factorial (x - 1) ;
else return 1;
}
-What is returned if factorial(0) is called?


A) 0
B) 1
C) 2
D) nothing, factorial(0) causes infinite recursion
E) nothing, factorial(0) produces a run-time error

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions