GATE 2014 CS (CS3) – Question 28
Which statements are correct?
1. Static allocation of all data areas by a compiler makes recursion impossible.
2. Automatic garbage collection is essential for recursion.
3. Dynamic allocation of activation records is essential for recursion.
4. Both heap and stack are essential for recursion.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (D) 1 and 3 only
Explanation
Multiple simultaneously active invocations need separate activation records, so a single statically allocated record per procedure cannot implement general recursion. Records must be created as calls occur, commonly on a runtime stack. Garbage collection and both heap plus stack are not essential. Thus **1and3only,D** under the standard general-recursion model.