Test Your Knowledge 3

Let's take a small quiz!

We'll cover the following

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

Question 1 of 100 attempted

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