< previous page page_378 next page >

Page 378
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
indicate whether each of the following actual parameters would be valid using pass-by-value, pass-by-reference, or both.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
a. letter
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
b. ANGLE
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
c. number
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
d. number + 3
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
e. 23
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
f. ANGLE * number
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
g. abs(number)
8. A variable named widgets is stored in memory location 13571. When the statements
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
widgets = 23;
Drop(widgets);
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
are executed, what information is passed to the formal parameter in function Drop? (Assume the formal parameter is a reference parameter.)
9. Assume that, in Exercise 8, the formal parameter for function Drop is named clunkers. After the function body performs the assignment
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
clunkers = 77;
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
what is the value in widgets? in clunkers?
10. Using the data values
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
3 2 4
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
show what is printed by the following program.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
#include <iostream.h>

void Test( int&, int&, int& );

int main()
{
    int a;
    int b;
    int c;

    Test(a, b, c);
    b = b + 10;
    cout << The answers are  << b <<   << c <<   << a;
    return 0;
}

void Test( int& z,
           int& x,
           int& a )
{

 
< previous page page_378 next page >