Solved

Consider the Mutually Recursive Methods Below

Question 105

Multiple Choice

Consider the mutually recursive methods below. Select the method call that could be used to generate the output sequence: A5 B4 A3 B2 A1 public static void methodA(int value)
{
If (value > 0)
{
System.out.print(" A" + value) ;
MethodB(value - 1) ;
}
}
Public static void methodB(int value)
{
If (value > 0)
{
System.out.print(" B" + value) ;
MethodA(value - 1) ;
}
}


A) methodA(5) ;
B) methodB(5) ;
C) methodA(4) ;
D) methodB(4) ;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions