Amhuxt.420 net.games.trivia utzoo!decvax!harpo!eagle!mhuxt!presley Mon Apr 19 16:18:03 1982 Parametrivia Here's a nice and easy quiz for those of you who miss those compiler courses you took in school. It's from the Gries book "Compiler Construction for Digital Computers". --------- Consider the ALGOL-like program: --------- BEGIN INTEGER I; INTEGER ARRAY B[1,2]; PROCEDURE Q(X); INTEGER X; BEGIN I := 1; X := X + 2; B[I] := 10; I := 2; X := X + 2; END; B[1] := 1; B[2] := 1; I := 1; Q(B[I]); END; --------- Tell what the final values for B[1] and B[2] are, assuming the formal parameter X to be: (1) called by reference, (2) called by value, (3) called by value result, (4) called by result, and (5) called by name. --------- Have fun! Answers in about a week or so. Joe Presley ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.