Homework #3 Solution Sketches: 1) What value of X is printed in procedure Sub1? 5 Under dynamic scoping rules, what value of X is printed in procedure Sub1? 10 2) Sub1: A, Y, Z of Sub1 X of Main Sub2: A, B, Z of Sub2 Y of Sub1 X of Main Sub3: A, X, W of Sub3 Y of Main 3) typedef in C: declaration e.g., the declaration "typedef int height;" makes the name "height" a synonym for int. Pascal type declaration: declaration e.g., the declaration "type DEVICES = (TERMINAL, PRINTER);" makes the name "DEVICES" a synonym for an enumerated type. Pascal variable declaration: definition e.g., the definition "var token: String" binds the identifier "token" to the data type "String." It also binds the identifier "token" to a particular memory location. Pascal forward declaration: declaration There is no location to bind. 4) Pascal makes no distinction between global variables and those local to the main program. This distinction is useful however because you may want variables to be "only" visible within the main program--which cannot be achieved in Pascal. C makes this distinction. Notice that Java is not an answer here because it does not support global variables. All variables in Java are local to some class, including those in main method. Alternate answers include Modula, COBOL, FORTRAN, and Perl.