Which of the following statements are CORRECT?
It will be D.
option 2 is wrong because it is not necessary to have automatic garbage collection to implement recursion.
option 4 is wrong because it says that both are required to implement recursion, which is wrong. Either of them will suffice.
Heap is having structure as CBT ..but for Recursion we need LIFO structure ...which only stack can provide ..
Is this right sir ??
1) In Static allocation of memory , we cannot implement recursion. As in recursion we cannot determine at first how many time function will be called
2)Automatic garbage collection done in JAVA (JVM done this) and LISP. But recursion we can implement in C too.So, Automatic Garbage Collection is not essential for Recursion
3) True. Same reason as 1)
4)Stack implement recursion, but heap is not necessary for recursion
Statement 1st is easy and we got it directly from nptel by sir YN srikant Lectures on run time environment.
statement 2nd is also well understood as we know c not allowed automatic GC and we can implement recursion there.
statement 4th is also fine there is quite difficulties to implementation recursion in heap because we know heap allow random allocation and de-allocation and moreover there is a simulation required for a well formed data structure.
Only Statement 3rd i am not getting here can anybody explain this?
Acc to my point of view activation record is created whenever there will be a entry of a procedure thats why there is a need of recursion.
This question can be solved by option elimination.
See the 4 th statement, it says both stack and heap are essential to implement recursion. But we know that only stack is enough to implement recursion. Hence 4 th statement is false.
Similarly statement 2 says automatic garbage collection is essential for recursion which is again false as there is no relationship of automatic garbage collection and recursion.
So statement 4 and 2 are false.
Hence we are left with only D as the correct answer.