Question 9818 – GATE 2000
May 4, 2024
Compiler-Design
May 4, 2024
Question 9818 – GATE 2000
May 4, 2024
Compiler-Design
May 4, 2024

Compiler-Design

Question 17

Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted.

Program main;
  Var ...
  
    Procedure A1;
     Var ...
     Call A2;
    End A1
    
    Procedure A2;
      Var ...
  
      Procedure A21;
        Var ...
        Call A1;
        End A21
        
    Call A21;
  End A21
  
    Call A1;
  End main.

Consider the calling chain : Main->A1->A2->A21->A1 The correct set of activation records along with their access links is given by:

A
B
C
D
Question 17 Explanation: 

Main → A1 → A2 → A21 → A1
Since, Activation records are created at procedure exit time.
A1 & A2 are defined under Main ( ). So A1 & A2 access links are pointed to main.
A21 is defined under A2, hence its access link will point to A2.
Correct Answer: D
Question 17 Explanation: 

Main → A1 → A2 → A21 → A1
Since, Activation records are created at procedure exit time.
A1 & A2 are defined under Main ( ). So A1 & A2 access links are pointed to main.
A21 is defined under A2, hence its access link will point to A2.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!