Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE CS 1997 | Question 68

Improve Article
Save Article
Like Article
  • Last Updated : 30 Oct, 2017
Improve Article
Save Article
Like Article

Consider the following program fragment in Pascal:

Program Main;
    var X : integer;
    procedure A:
       var Y : integer;
    procedure B:
       var Z : integer;
    procedure C:
       var Z : integer;
    begin(*Procedure C*)
    .
    .
    end(*Procedure C*)
 begin(*Procedure B*)
    .
    .
 C; (*call to C*)
 A; (*call to A*)
        .
        .

 end(*Procedure B*)
 begin(*Procedure A*)
        .
        .
        B; (*call to B*)
        .
        .
  end(*Procedure A*)
begin (*Main*)

Assume that there are no calls to any procedures other than the ones indicated above. It is known that at some point of time during the execution of this program five activation records exist on the run-time stack. Describe the run-time stack at this point of time by clearly indicating the following: the top of the stack, the contents of the static link and dynamic link, and allocation of the local variables in each record.


Answer:

Explanation:

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!