List all the variables along with the program units


Discuss the below:

Consider the following program:

Q: List all the variables, along with the program units where they are declared, that are visible in the bodies of Sub1, Sub2, and Sub3, assuming static scoping is used.

procedure Main is
X, Y, Z : Integer;
procedure Sub1 is
A, Y, Z : Integer;
procedure Sub2 is
A, B, Z : Integer;
begin -- of Sub2
...
end; -- of Sub2
begin -- of Sub1
...
end; -- of Sub1
procedure Sub3 is
A, X, W : Integer;
begin -- of Sub3
...
End; -- of Sub3
Begin -- of Main
...
End; -- of Main

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: List all the variables along with the program units
Reference No:- TGS01939396

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)