?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Recursion

APCSA-MGIXB1

Consider the following method.

 public int mystery(int x)
 {
     if (x == 0)
        return 0;
     else
        return (x % 10 + mystery(x/10));
 }

What is returned as a result of the call mystery(43951)?

A

4881

B

4395

C

22

D

540

E

Nothing is returned due to infinite recursion.