| preferred AP College board partner for AP classes
AP Computer Science A/Unit 10: Recursion
Start Practice Test
Share
medium Solved by 7 students
Recursive Method Analysis
< Prev
Next >

Consider the following incomplete method.

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

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

A

2 * mystery(x – 1)

B

4 + mystery(x – 1)

C

2 * mystery(x – 2)

D

4 * mystery(x – 4)

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1songqiuhui201211 0m 14s 86
#2singhris00011 0m 27s 73
#3richa.tuli22 3m 17s 3
#4ethan14 3m 40s -150
#5suhanakochhar00612 4m 21s -171
APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy