| preferred AP College board partner for AP classes
hard
Recursive Boolean Method Output
< Prev
Next >

What is the output when the above program is executed?

public class Main {
    public static boolean isPowerOfTwo(int n) {
        if(n < 1)
            return false;
        if(n == 1)
            return true;
        if(n % 2 != 0)
            return false;
        return isPowerOfTwo(n / 2);
    }
    public static void main(String[] args) {
        System.out.println(isPowerOfTwo(32));
    }
}
A

‘32’

B

false

C

true

D

null

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.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy