Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice TestPractice Test
About Exam
medium Solved by 8 students

Recursive Power Method Output

Mark
< Prev
Next >

What is printed when the following code is executed?

public class PowerCalc {
    public static int power(int base, int exponent) {
        if(exponent == 0) return 1;
        return base * power(base, exponent - 1);
    }
    public static void main(String[] args) {
        System.out.println(power(3, 3));
    }
}
A

81

B

27

C

9

D

3

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1Potter1611 0m 08s 92
#2kaisuki12 0m 00s 90
#3bommasam00011 0m 41s 59
#4richa.tuli11 0m 52s 48
#5liuwilliam07241011 1m 09s 31
#6lsj0803092211 1m 52s -12
#7chunxiangxu.cxu02 0m 52s -72
#8y.seong202711 2m 53s -73
#9zgj0731041711 18m 08s -988
Items per page:
10
1 – 9 of 9

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|