Solved

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

Question 28

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 powerOfTwo(63) (not including the original call) ?


A) 6
B) 4
C) 1
D) 0

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions