Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following ALGOL code: ( * please notice any text between ( * * . . * * ) is a comment. Also, all

Given the following ALGOL code:
(* please notice any text between (**..**) is a comment. Also, all labels blk1, blk2, blk3 are not
part of the program, they just to show you the starting of blocks' codes.*)
main: begin (* main program block definition *)
integer h,m; real n;
procedure P(k); value k ; integer k;
blk1: begin integer o;
procedure R(q); value q; real q;
blk2: begin real v; v := q+ m; PrintInteger(v); end (* blk2*);
procedure S(i); value i; integer i;
blk3: begin integer m;m:=i+15;R(m) end ();
(**blk1-P code **)
o:=k+m;S(o);
end (**blk1-P code **)
begin (* the main program block code *)
h:=25;m:=30;n:=2.7;P(h)
end (* end of main program (block) code *)
end (* end of main program (block) definition *)
a) What would be the printed value of "v", in blk2 above, in each of the following
scoping mechanisms: i) static? ii) dynamic?
You must show the picture of the system stack upon the execution of the "PrintInteger(v)".
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

i need correct answrrs 5 9 2 .

Answered: 1 week ago