Spring 2001, CSE 428: Quiz 4.1 - 8 Feb 2001


Please write your Name, Student ID, and Section at the top of the page.
  1. [Pts 2]

    Which of the following parameter-passing methods should be used to implement a non-strict function (only one answer, please)

    1. call by value
    2. call by value-result
    3. call by name
    4. call by reference

  2. [Pts 3]

    For each of the following parameter passing methods, say whether the actual parameter can be a generic expression or must be a variable

    1. call by value     can be a generic expression
    2. call by value-result     must be a variable
    3. call by name     can be a generic expression

  3. [Pts 3]

    Consider the following procedure and fragment of code in C++ like. Assume that z is a global variable.

       void p(int ... x, int ... y){ x = x+1; y = y+1; }
       ...
       z = 1;
       p(z,z);
       cout << z;
       ...
    
    What is the value printed by the instruction cout << z; under each the following parameter passing methods (for both the parameters x and y):

    1. call by value     1
    2. call by value-result     2
    3. call by reference     3

  4. [Pts 2]

    The activation record associated to a function call contains storage for: (only one answer, please)

    1. the source code of the function
    2. the local variables of the function
    3. the local variables of the caller
    4. the dynamic (aka user-defined) variables created during the execution of the function call