APFIVE APFIVE | preferred AP College board partner for AP classes
AP Classes
AP Computer Science A
AP Human Geography
AP Comparative Government and Politics
AP European History
AP Macroeconomics
AP Microeconomics
AP Psychology
AP United States Government and Politics
AP United States History
AP Calculus AB
AP Calculus BC
AP Computer Science Principles
AP Precalculus
AP Statistics
AP Biology
AP Chemistry
AP Environmental Science
AP Chinese
AP Art History
AP English Literature
AP Research
AP Spanish Literature
AP Art & Design
AP World History: Modern
AP English Language
AP French
AP German
AP Japanese
AP Latin
AP Italian
AP Spanish Language
AP Music Theory
AP Physics 1
AP Physics 2
AP Physics C: Mechanics
AP Physics C: E&M
AP African American Studies
AP Computer Science A/Unit 10: Recursion
Start Practice Test
Share
medium Solved by 2 students
Evaluating a Recursive Method
< Prev
Next >

What will be the outcome of coconut(4)?
Following is the implementation of a recursive method:

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

What will be the outcome of coconut(4)?

A

17

B

34

C

14

D

26

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

Question Leaderboard

Not enough data yet to show leaderboard.

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