Test Your Knowledge 3

Let's take a small quiz!

We'll cover the following...
...

This Quiz will take maximum 10 minutes.

1

What is the output of the following code?

function foo(x, p) {
    if (p == 0) {
      return 1;
    }
    else {
      return (x * foo(x, p - 1));
    }
}
    
// Driver Code
console.log(foo(2, 5));
A)

2

B)

16

C)

32

D)

1

Question 1 of 70 attempted
...
Access this course and 1400+ top-rated courses and projects.