Quick Quiz on Recursion with Numbers!
This lesson will test your knowledge on recursion with numbers.
Technical Quiz
1.
What is the output of the following code?
public static int pow(int b, int p)
{
if (p == 0)
{
return 1;
}
else
{
return (b*pow(b, p-1));
}
}
public static void main(String args[])
{
System.out.print(pow(2,5));
}
A.
2
B.
16
C.
32
D.
1
1 / 3
Now that we have ...