Quiz Yourself on Recursion

Attempt the following quiz to test your understanding of recursion.

We'll cover the following...
Technical Quiz
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


1 / 15