Question: 1 -
Uses are Recursion in Java are___.
-
Traversing folders and files on a disk
-
All the above
-
Evaluating Nth order equations and Factorials
-
Traversing the nodes of a Binary Tree
Answer:
All the above
Solution not available.
Question: 2 -
Java uses ___ type of memory to implement Recursion.
-
Stack
-
None of these
-
Heap
-
Register
Answer:
Stack
Solution:
Yes. Java uses Stack type memory to implement Recursion.
Yes. Java uses Stack type memory to implement Recursion.
Question: 3 -
Which is better in terms of memory utilization Recursion or Loops in Java?
-
Flow control
-
Recursion
-
Methods
-
Loops
Answer:
Loops
Solution:
Loops or iterations are better memory-optimized than Recursion technique that solely depends on the Stack memory.
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.
-
None of these
-
LIFO (Last In First Out)
-
FIFO (First In First Out)
-
Round Robin
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.
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 ___.
-
Methods
-
Constructors
-
Variables
-
Blocks
Answer:
Methods