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
medium Solved by 3 students

Evaluating a Recursive Method

Mark
< Prev
Next >

Consider the following recursive method coconut.

public int coconut(int k) {
  if (k == 1) {
    return 2;
  } else {
    return 2 * coconut(k - 1) + k;
  }
}

What value is returned as a result of the call coconut(4)?

A

34

B

26

C

17

D

14

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|