Solved

Consider the Method PowerOfTwo Shown Below: Public Boolean PowerOfTwo(int N)

Question 2

Multiple Choice

Consider the method powerOfTwo shown below: public boolean powerOfTwo(int n)
{
If (n == 1) // line #1
{
Return true;
}
Else if (n % 2 == 1) // line #2
{
Return false;
}
Else
{
Return powerOfTwo(n / 2) ; // line #3
}
}
How many recursive calls are made from the original call of powerOfTwo(64) (not including the original call) ?


A) 8
B) 6
C) 4
D) 2

Correct Answer:

verifed

Verified

Related Questions