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 2 students

Recursive Method Return Value

Mark
< Prev
Next >

Consider the following method.

public int computeDepth(int a, int b, int increment)
{
    if (a == 0)
        return b;
    else
        return b + computeDepth(a - 1, b, increment + 1);
}

What is returned by the call computeDepth(2, 5, 1)?

A

10

B

11

C

15

D

12

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|