Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE DON'T COPY ANSWER WHICH IS ALREADY WRONG THANKS. 3. (8 points) Consider the Ada program given below. You will be asked to determine which
PLEASE DON'T COPY ANSWER WHICH IS ALREADY WRONG THANKS.
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; 7. 8. procedure Subl is 4. D, E: Integer; 5. begin of Sub1 6. end; -- of Sub1 procedure Sub2 is 9. C, D : Integer; 10. procedure Sub3 is 11. B, D, F: Integer; 12. begin -- of Sub3 13. 14. end; -- of Sub3 15. 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, Subi, 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 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 SublStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started