?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Recursive Method With Three Parameters

APCSA-GTKNTN

Consider the following method.

public static int mystery(int x, int y, int z)
{
    if (x > z)
        return x + (y%2) + mystery(x - z, y - 1, z + 1);
    else
        return x*y*z;
}

What is the returned value of mystery(9, 4, 2)?

A

21

B

29

C

49

D

55

E

80