< previous page page_377 next page >

Page 377
3. For the program in Exercise 2, fill in the blanks with variable names to show the matching that takes place between the actual and the formal parameter lists in each of the two calls to the Test function.
First Call to Test
Second Call to Test
Formal
Actual
Formal
Actual
1._____
_____
1._____
_____
2._____
_____
2._____
_____
3._____
_____
3._____
_____

4. What is the output of the following program?
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
#include <iostream.h>

void Print( int, int );

int main()
{
    int n;

    n = 3;
    Print(5, n);
    Print(n, n);
    Print (n * n, 12);
    return 0;
}

void Print( int a,
            int b )
{
    int c;

    c = 2 * a + b;
    cout << a <<   << b    c << endl;
}
5. Using a reference parameter (passing by reference), a function can obtain the initial value of an actual parameter as well as change the value of the actual parameter. (True or False?)
6. Using a value parameter, the value of a variable can be passed to a function and used for computation there, without any modification of the actual parameter. (True or False?)
7. Given the declarations
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
const int ANGLE = 90;

char letter;
int number;

 
< previous page page_377 next page >