Recursion

Pre Test

  1. In general, which of the following methods isn’t used to find the factorial of a number?

  2. Non iterative / recursive
    Iteration
    Dynamic programming
    Recursion

  3. Which of the following recursive formula can be used to find the factorial of a number?

  4. fact(n) = n * fact(n)
    fact(n) = n * fact(n+1)
    fact(n) = n * fact(1)
    fact(n) = n * fact(n-1)

  5. Which of the following problem cannot be solved using recursion?

  6. Tower of Hanoi
    Problems without base case
    Tree Traversal
    Fibonacci series

  7. Choose the correct answer.

  8. Recursion uses more memory compared to iteration?
    Recursion is always better than iteration.
    Recursion uses less memory compared to iteration.
    Iterative function is always better and simpler to write than recursion.

  9. Recursion is similar to which of the following?

  10. Switch Case
    Loop
    If-else
    None