2,216 views
0 votes
0 votes

Consider the following statements with respect to storage allocation:
1. Names local to a procedure are allocated space on a heap automatically.
2. Stack allocation is used for data that may live even after a procedure call returns.
3. Heap allocation is used for symbol table.
Which one of the following is true?

  • 1, 2 are true but 3 is false
  • 1, 3 are true but 2 is false
  • 2, 3 are true but 1 is false
  • 1, 2 are false but 3 is true

1 Answer

2 votes
2 votes
I think only 3 is true.

1) Local variable are present in the activation record of procedures which will be present in program stack and not heap.

2) Lifetime of local variables in stack allocation is only within the procedure.

3) Symbol table has to grow dynamically and hence memory heap has to be used.

Related questions

0 votes
0 votes
1 answer
2
S Ram asked Jan 15, 2017
1,191 views
preorder traversal of a tree resemble to the DFS traversal of graph?
1 votes
1 votes
1 answer
3
srestha asked Jan 8, 2017
1,236 views
In hash function using linear probing to reduce collision, the number of probes required to insert an item is identical with number of probes needed to retrieve it.is it ...