Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 3 students

Evaluating a Recursive Method

< 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
Mark for review

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: apfive@apfive.org|Privacy Policy|FAQ