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
easy

Recursive Power Method Call

Mark
< Prev
Next >

Consider the following method.

public int power(int base, int exp) {
    if(exp == 0) {
        return 1;
    }
    return base * power(base, exp - 1);
}

What value is returned by the call power(2, 3)?

A

8

B

9

C

6

D

error

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|