Description
1. (8 points) Consider the following pseudocode. What does this program print if the
language uses static scoping? What does it print with dynamic scoping? Why?
1. procedure main
2. a : integer := 1
3. b : integer := 2
4. procedure A
5. a : integer := 3
6. b : integer := 4
7. B()
8. print a, b
9. procedure B
10. print a, b
11. a := 5
12. b := 6
11. — body of main
12. A()
13. print a, b
2. (8 points) Chapter 3. Exercise 3.6. (a) and (b).
3. (4 points) Chapter 3. Exercise 3.9. (a)
4. (8 points) Chapter 3. Exercise 3.14.
5. (8 points) Chapter 3. Exercise 3.19. (a) and (b). (ignore deep-binding)