Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 9 students

Recursive Power Method Output

< 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
Mark for review

Question Leaderboard

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

AI Tutor

How can I help?

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