Heap allocation is required for languages
1997
Heap allocation is required for languages
Answer: B. that support dynamic data structures — Memory in a language runtime is typically divided to handle different lifetimes: Static/Code Area: For global variables and compile-time fixed data. Stack…
- A.
that support recursion
- B.
that support dynamic data structures
- C.
that use dynamic scope rules
- D.
none of the above
Attempted by 276 students.
Show answer & explanation
Correct answer: B
Memory in a language runtime is typically divided to handle different lifetimes:
Static/Code Area: For global variables and compile-time fixed data.
Stack Area: For local variables and function execution flow (handles recursion).
Heap Area: For unstructured, dynamically allocated memory whose lifetime is controlled directly by the programmer or a garbage collector.
Because dynamic data structures require memory elements to be allocated and deallocated at unpredictable times during execution without respecting a strict function-return order, Heap allocation is strictly required.
Explore the full course: Iocl Engineers Officers Grade A Paper 2