edited by
12,962 views
49 votes
49 votes

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
edited by

3 Answers

Best answer
42 votes
42 votes

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.

edited by
24 votes
24 votes

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

2 votes
2 votes

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 as the correct answer.

 

 

Answer:

Related questions

67 votes
67 votes
4 answers
1
60 votes
60 votes
7 answers
2
go_editor asked Sep 28, 2014
19,050 views
The minimum number of arithmetic operations required to evaluate the polynomial $P(X) = X^5+4X^3+6X+5$ for a given value of $X$, using only one temporary variable is ____...
29 votes
29 votes
4 answers
3
go_editor asked Sep 28, 2014
9,178 views
Which one of the following is NOT performed during compilation?Dynamic memory allocationType checkingSymbol table managementInline expansion
35 votes
35 votes
4 answers
4