| 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
< Prev
Next >

Which of the following could be used to replace /* missing code*/ so that the value of mystery(10) is 32?

Consider the following incomplete method:

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

Which of the following could be used to replace /* missing code*/ so that the value of mystery(10) is 32?

A

4 + mystery(x – 1)

B

4 * mystery(x – 4)

C

2 * mystery(x – 2)

D

2 * mystery(x – 1)

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.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy