Discussion
Which languages necessarily need heap allocation in the run time environment?
Answer: D
Correct answer: Those that allow dynamic data structures
A heap is needed when the amount of storage required is not known until run time, and when objects must outlive the function that created them. Dynamic data structures - lists, trees, growable arrays - require exactly that.
Recursion needs only a stack, since each activation is destroyed in reverse order of creation. Dynamic scoping is a name-resolution rule, and global variables have static storage decided at compile time. None of those three forces a heap.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development