Recursive Method Return Value
What value is returned as a result of a call to mystery(10)?
Consider the following recursive method:
public static int mystery(int x)
{
if (x == 0) {
return 0;
} else {
return (x + mystery(x / 2) + mystery(x / 4));
}
}
What value is returned as a result of a call to mystery(10)?
A
12
B
20
C
22
D
10
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE