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


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

    A non-strict function can (only one answer please)

    1. return a value even if one of the arguments, when evaluated, would give error
    2. use a non-strict typing discipline for the evaluation of the result
    3. use a non-strict typing discipline for the evaluatuation of the arguments
    4. receive an arbitrary number of arguments at the moment of the call

  2. [Pts 3]

    For each of the following parameter passing methods, say whether the actual parameter can be modified by the call (assuming that it is a variable and that it does not occur inside the body)

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

  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; cout << y; }
       ...
       z = 1;
       p(z,z);
       ...
    
    What is the value printed by the instruction cout << y; under each the following parameter passing methods (for both the parameters x and y):

    1. call by value     2
    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 variables which are created with the instruction new in the body of the function
    2. the formal parameters with the call-by-value method
    3. the formal parameters with the call-by-reference method
    4. the compiled code of the function