Quiz: Recursion

To View Tricks: Login Required

Number of Questions: 10

Question: 1 -

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

Options:
  1. LIFO (Last In First Out)

  2. Round Robin

  3. None of these

  4. FIFO (First In First Out)

  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: 2 -

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

Options:
  1. Loops

  2. Flow control

  3. Methods

  4. Recursion

  5. Answer:

    Loops

    Solution:

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


Question: 3 -

Recursion in Java applies to ___.

Options:
  1. Methods

  2. Variables

  3. Constructors

  4. Blocks

  5. Answer:

    Methods

    Solution not available.

Question: 4 -

Uses are Recursion in Java are___.

Options:
  1. Traversing the nodes of a Binary Tree

  2. Traversing folders and files on a disk

  3. All the above

  4. Evaluating Nth order equations and Factorials

  5. Answer:

    All the above

    Solution not available.

Question: 5 -

Java uses ___ type of memory to implement Recursion.

Options:
  1. Register

  2. Stack

  3. Heap

  4. None of these

  5. Answer:

    Stack

    Solution:

    Yes. Java uses Stack type memory to implement Recursion.