Project ForgeSign up free
Compiler Design
Lexical Analysis & Parsing
GATE 2010
Medium

Which languages necessarily need heap allocation in the runtime environment?

  • AThose that support recursion.
  • BThose that use dynamic scoping.
  • Those that allow dynamic data structures.
  • DThose that use global variables.

Explanation

Recursion needs only a stack (activation records), not a heap. Dynamic scoping and global variables don't inherently require heap allocation either. Only languages allowing DYNAMIC DATA STRUCTURES (whose size/lifetime isn't known at compile time or tied to a call frame) fundamentally need heap allocation.

Source: GATE CS 2010 (2010)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free