Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions