Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 6 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 – 4)

C

2 * mystery(x – 2)

D

4 + mystery(x – 1)

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1songqiuhui201211 0m 14s 86
#2singhris00011 0m 27s 73
#3richa.tuli22 3m 17s 3
#4ethan14 3m 40s -150
#5suhanakochhar00612 4m 21s -171
Items per page:
10
1 – 5 of 5
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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