- What is the difference between an actual and formal parameter?
- With which of the parameter passing techniques could
you implement a swap function? (A swap function exchanges
the values of the actuals.)
- Which of the parameter passing techniques entail stack allocation for
formals?
- Write a procedure definition and code that calls it that runs
differently with pass by value and pass by reference.
- Write a procedure definition and code that calls it that runs
differently with pass by value result and pass by reference.
- Suppose f is a procedure defined to take one parameter of type int by
value result. Which of the following calls might result in an error?
If your answer is "it depends," explain why.
- f(3)
- f(x)
- f(x + 3)
- f(g(1))
- Discuss one advantage of pass by value over pass by reference.
- Discuss one advantage of pass by reference over pass by value.
- Pass by name is normally implemented such that the
actual parameter is reevaluated each time it is used in the
procedure. What implementation shortcut allows more
efficient implementation in pure functional languages, and
what feature of pure functional languages permits this
shortcut?
- What is an L-value?
- In C++, is it possible for a function to return an L-value?