Question: 3. (8 points) Consider the Ada program given below. You will be asked to determine which variables are visible in a number of different sit-

 3. (8 points) Consider the Ada program given below. You will

3. (8 points) Consider the Ada program given below. You will be asked to determine which variables are visible in a number of different sit- uations. In each case, identify each variable by its name and the line number of its declaration. 1. procedure Main is 2. A, B, C : Integer; procedure Subl is D, E: Integer; begin -- of Sub1 . ' end; -- of Sub1 procedure Sub2 is C, D : Integer; procedure Sub3 is B, D, F: Integer; begin -- of Sub3 end; -- of Sub3 begin -- of Sub2 16. 17. end; -- of Sub2 18. begin -- of Main 19. ... 20. end; -- of Main (a) Assuming that static scoping is used, say which variables are visible in the bodies of each of the procedures: Main, Subl, Sub2 and Sub3. (b) Assuming that dynamic scoping is used and the calling sequence is Main calls Subl; Subl calls Sub2; Sub2 calls Sub3, say which variables are visible in Sub3. (c) Assuming that dynamic scoping is used and the calling sequence is Main calls Sub2; Sub2 calls Sub3; Sub3 calls Sub1, say which variables are visible in Subl. Assuming that dynamic scoping is used and the calling sequence is Main calls Sub2; Sub2 calls Subl, say which variables are visible in Subl. (d)

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!