The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+1 vote
Consider the following two statements:
 S1: Activation records can have permanent lifetime in case of static allocation.
S2: Activation records can have nested lifetime in case of stack allocation.
Which of the option is correct regarding S1 and S2 respectively
(A) True. True
(B) True. False
(C) False. True
 (D) False. False
asked in Compiler Design by Veteran (39.3k points)
retagged by | 181 views
option c ?
Its A.

4 Answers

+2 votes

Activation records have Permanent Lifetime in case of Static Allocation, 
bcoz in case of Static Allocation, Activation records r fixed in static memory area so why it supports function calling but not recursion
Nested Lifetime in case of Stack Allocation
bcoz in case of Stack Allocation, Activation record are pushed into stack area during function call or recursion nd popped out on function return. so why these r nt permanent
Hence ans is A

answered by Veteran (12k points)
But why is it permanent ? It will also get destroyed after main is finished ? I just have doubt with the word "PERMANENT" ?
Permanent is used in the sense that a variable is bound to a fixed location in static allocation.

Yes ultimately everything gets destroyed after program termination!! :p
^ u r correct
+1 vote

Activation records have Permanent Lifetime in case of Static Allocation, Nested Lifetime in case of Stack Allocation and Arbitrary Lifetime in case of Heap Allocation.

So, option A.

answered by Veteran (10.3k points)
How is it permanent in static, won't it be destroyed after main returns or finishes ?
Provide explaination if possible ?
+1 vote

Activation Record has 3 kind of allocation

1)Static allocation

2)Stack Allocation

3) Heap Allocation

Static Allocation means it is in a fixed location of memory. Doesnot change when program executes.No change required at runtime.

Stack Allocation means it works like LIFO. So, requires recursive function calls


answered by Veteran (70k points)
0 votes
b)Stack/Heap allocation is used in dynamic storage allocation , also recursion is supported here which means there will each activation record for each procedure call i.e. nested ARs so as each procedure completes its work its AR  gets deleted.

Moreover there is dynamic chain which provides stack nature of Activation Record

a) Activation Records are created at compile time and in static allocation method and are removed when programme is over(or after running garbage collector) So we can say that ARs have permanent lifetime.

here permanent means during all course of programme running.
answered by Active (1.1k points)

Related questions

0 votes
2 answers
asked in Compiler Design by ManojK Veteran (39.3k points) | 193 views
+2 votes
1 answer
asked ago in Digital Logic by Manoja Rajalakshmi A Junior (575 points) | 38 views
+1 vote
0 answers
asked ago in Digital Logic by Manoja Rajalakshmi A Junior (575 points) | 13 views

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,947 questions
36,793 answers
34,690 users