| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice Test
Share
medium Solved by 5 students
Recursive Power Method Output
< Prev
Next >

What is printed when the program 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

9

B

27

C

81

D

3

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki12 0m 00s 90
#2richa.tuli11 0m 52s 48
#3lsj0803092211 1m 52s -12
#4y.seong202711 2m 53s -73
APFIVE © 2020.
Email: [email protected]|Privacy Policy