Question: 3 Language Srascture didtem ExamFall20/8 page 5 (4). Consider the Pascal/Ada-like block-structured program atmain block the right. Suppose that the program contains no forward declarations.
3 Language Srascture didtem ExamFall20/8 page 5 (4). Consider the Pascal/Ada-like "block-structured" program atmain block the right. Suppose that the program contains no "forward" declarations. Suppose further that a variable named X is declared in the main block, in procedure D, and in procedure F, but nowhere else. Finally, suppose a variable named X is accessed (but not de- clared locally, and not listed as a formal parameter) in procedure E var X... proc A oc C (a). Assuming static (lexical) scoping (as is the case in Pascal and Ada), which version of X will be used within E? (3) proc D var X... proc E proc F (b). Assuming dynamic scoping, give a call sequence starting from "main" and terminating with E, in which the version of X used within E will be F's version. var X... (c). Assuming PascalAda's activation rules, what procedures can the main program block invoke? (d). What procedures can procedure F invoke? (e). What procedures can procedure D invoke? (). What procedures can procedure A invoke
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
