- [Pts 2]
A non-strict function can (only one answer please)
- return a value even if one of the arguments, when evaluated, would give error
- use a non-strict typing discipline for the evaluation of the result
- use a non-strict typing discipline for the evaluatuation of the arguments
- receive an arbitrary number of arguments at the moment of the call
- [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)
- call by value no
- call by value-result yes
- call by reference yes
- [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):
- call by value 2
- call by value-result 2
- call by reference 3
- [Pts 2]
The activation record associated to a function call contains storage for:
(only one answer, please)
- the variables which are created with the
instruction new in the body of the function
- the formal parameters with the call-by-value method
- the formal parameters with the call-by-reference method
- the compiled code of the function