?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Stacking Methods in Recursion

APCSA-EUFWIX

Consider the following method:

 public void quest(String s)
 {
     int n = s.length();
     if (n > 1)
     {
        String temp = s.substring(0, n - 1);
        quest(temp);
        System.out.println(temp);
     }
 }

What is printed as a result of the call quest("TANGO")?

A

TANG
TAN
TA
T

B

T
TA
TAN
TANG
TANGO

C

T
TA
TAN
TANG

D

TANGO
TANG
TAN
TA
T

E

TANGO