Recursive Factorial Method Analysis
Consider the following factorial method. Which statement about the method’s recursive implementation is false?
public int factorial(int n) {
if (n <= 1)
return 1;
else
return n * factorial(n - 1);
}
A
At each recursive step, the method multiplies n by the factorial of (n - 1).
B
The base case stops recursion when n is less than or equal to 1.
C
The factorial method performs multiple recursive calls simultaneously at each level of recursion.
D
The recursion in the factorial method reduces the problem size by decrementing n with each call.
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | ethan | 1 | 1 | 0m 17s | 83 |
| #2 | richa.tuli | 1 | 2 | 0m 30s | 60 |
| #3 | theofanusmischa | 0 | 1 | 0m 00s | -10 |
| #4 | bommasam000 | 1 | 3 | 2m 12s | -52 |
| #5 | singhris000 | 1 | 3 | 3m 25s | -125 |
APFIVE