Show the worked solutionHeap allocation is needed when storage is created and freed at run time in an order that does not follow procedure calls and returns, such as nodes of linked lists and trees created with malloc or new. These dynamic data structures must outlive the call that created them.(A) Dynamic scope is about name lookup; it is handled with the stack — incorrect.(C) Recursion is handled by stack allocation of activation records — incorrect.(D) Recursion alone does not need a heap, so the combination is not the requirement — incorrect.Answer: B
GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com