Question: Trace the program and write down the output using both static scoping and dynamic scoping. procedure program is X, Y, A, B: integer; procedure Sub1

Trace the program and write down the output using both static scoping and dynamic scoping.

procedure program is X, Y, A, B: integer; procedure Sub1 is X, Y: integer; Begin X := 2*A; Y := 3*B; output(A,B,X,Y); End; procedure Sub2 is X, B: integer; procedure Sub3 is X: integer; begin X := 3*A; A := X+3; B := A+1; output(A, B, X, Y); end; begin X := 2*Y; B := A; Sub3; output(A, B, X, Y); end; begin A := 1; B := 2; X := 3; Y := 4; output(A, B, X, Y); Sub1; output(A, B, X, Y); Sub2; output(A, B, X, Y); end;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!