Quiz: Recursion

To View Tricks: Login Required

Number of Questions: 10

Question: 1 -

Uses are Recursion in Java are___.

Options:
  1. Traversing folders and files on a disk

  2. All the above

  3. Evaluating Nth order equations and Factorials

  4. Traversing the nodes of a Binary Tree

  5. Answer:

    All the above

    Solution not available.

Question: 2 -

Java uses ___ type of memory to implement Recursion.

Options:
  1. Stack

  2. None of these

  3. Heap

  4. Register

  5. Answer:

    Stack

    Solution:

    Yes. Java uses Stack type memory to implement Recursion.


Question: 3 -

Which is better in terms of memory utilization Recursion or Loops in Java?

Options:
  1. Flow control

  2. Recursion

  3. Methods

  4. Loops

  5. Answer:

    Loops

    Solution:

    Loops or iterations are better memory-optimized than Recursion technique that solely depends on the Stack memory.


Question: 4 -

Java uses Stack type memory instead of Heap type memory in implementing Recursion because of ___ feature of STACK.

Options:
  1. None of these

  2. LIFO (Last In First Out)

  3. FIFO (First In First Out)

  4. Round Robin

  5. Answer:

    LIFO (Last In First Out)

    Solution:

    Recursion unwinds and completes all methods from the latest to the oldest. So, it requires the LIFO strategy offered by Stack memory.


Question: 5 -

Recursion in Java applies to ___.

Options:
  1. Methods

  2. Constructors

  3. Variables

  4. Blocks

  5. Answer:

    Methods

    Solution not available.