Recursive Method Call Trace
What value is returned as a result of the call mystery(10)?
Consider the following method:
public static int mystery(int n)
{
if (n == 0)
{
return 0;
}
else
{
return mystery(n / 2) + (n % 2);
}
}
What value is returned as a result of the call mystery(10)?
A
2
B
4
C
1
D
3
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE