StreakPeaked· Practice

ExamsGATETechnical

Which of the following statements are CORRECT? 1) Static allocation of all data areas by a compiler makes it impossible to implement recursion. 2) Automatic garbage collection is essential to implement recursion. 3) Dynamic allocation of activation records is essential to implement recursion. 4) Both heap and stack are essential to implement recursion.

  1. 1 and 2 only
  2. 2 and 3 only
  3. 3 and 4 only
  4. 1 and 3 only

Correct answer: 1 and 3 only

Solution

Static allocation of data areas does indeed hinder recursion because it limits the ability to create new activation records for each recursive call. Additionally, dynamic allocation of activation records is crucial for recursion, as it allows each call to maintain its own state without overwriting previous calls.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →