This preview shows page 1. Sign up to view the full content.
Unformatted text preview: c. Suppose static scoping is used. What is the value printed by the program? 2. What is the value printed by the following pseudo-code program for each of the four parameter passing modes call-by-value , call-by-reference , call-by-value/result , and call-by-name ? That is, for each of the four parameter passing modes assume that both the x and y parameters use that mode. Show how each program is evaluated in that mode and show the final value printed: a : integer // a global variable procedure p(x : integer, y : integer) x := x + 1 a := y begin // main program a := 2 p(a, a) write_integer(a) end...
View Full Document
- Spring '11