Question: (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.

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

(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; 3. procedure Subl is 4. DE: Integer 5. begin -- of Subi 6. end; -- of Sub1 8. procedure Sub2 is CD: Integer ; 10. procedure Sub3 is 11. B. D. F: Integer; 12. begin- of Sub3 13. end: - of Sub3 begin- of Sub2 16. 17. end: - of Sub2 18. begin -- of Main 19. 20. end; -- of Main 15. (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 Sub 3: Sub3 calls Subl, say which variables are visible in Subl. (d) Assuming that dynamic scoping is used and the calling sequence is Main calls Sub2: Sub2 calls Subl, say which variables are visible in Subl

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!