Recursive Method Return Value
Consider the following method.
public int mystery(int x)
{
if (x <= 1) {
return 1;
} else {
return ( /* missing code */ );
}
}
Which of the following can replace /* missing code */ so that the method call mystery(10) returns 32?
A
4 * mystery(x – 4)
B
2 * mystery(x – 1)
C
4 + mystery(x – 1)
D
2 * mystery(x – 2)
Question Leaderboard
Not enough data yet to show leaderboard.
