...

/

Test Your Knowledge 3

Test Your Knowledge 3

Let's take a small quiz!

Quiz on Recursion with Numbers

This Quiz will take maximum 10 minutes.

1.

What is the output of the following code?

def foo(x, p) :
    if (p == 0):
      return 1;
    else :
      return (x * foo(x, p - 1))
    
# Driver Code
print(foo(2, 5))
A.

2

B.

16

C.

32

D.

1


1 / 10

In the next chapter, we will be dealing with strings using recursion.