Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 10: Recursion
Start Practice TestPractice Test
About Exam
hard

Recursive Method Return Value

Mark
< Prev
Next >

Consider the following method.

public int mystery(int x)
{
   if (x <= 1) {
      return 1; 
   } else {
      return ( /* missing code */ ); 
   }
}

Which of the following can replace /* missing code */ so that the method call mystery(10) returns 32?

A

4 * mystery(x – 4)

B

2 * mystery(x – 1)

C

4 + mystery(x – 1)

D

2 * mystery(x – 2)

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|