Quiz Yourself on Recursion
Attempt the following quiz to test your understanding of recursion.
1
Consider the following method:
public static int func(int x)
{
if (x > 0)
return x + func(x - 1);
return 0;
}
What is the result when func(5)
is called?
A)
0
B)
14
C)
15
D)
21
Question 1 of 150 attempted
Get hands-on with 1400+ tech skills courses.