Consider the function, where the programmer inadvertently left out the ampersand in the definition of parRef. What is the output of the code?

```
void doStuff(int parValue, int parRef)
{
parValue = 100;
cout << “parValue in call to doStuff = “
<< parValue << endl;
parRef =222;
cout << “parRef in call to doStuff = “
<< parRef << endl;
}
```

and consider the call, which we assume is in a complete and correct program
```
int n1 = 1, n2 =2;
doStuff(n1, n2);
cout << “n1 after call to doStuff = “ << n1 << endl;
cout << “n2 after call to doStuff = “ << n2 << endl;
```

a. parValue in the call to doStuff = 100;
parValue in the call to doStuff = 222;
n1 after function call = 1;
n2 after function call = 222
b. parValue in the call to doStuff = 100;
parValue in the call to doStuff = 222;
n1 after function call = 1;
n2 after function call = 2
c. x parValue in the call to doStuff = 100;
parValue in the call to doStuff = 222;
n1 after function call = 100
n2 after function call = 2
d. parValue in the call to doStuff = 100;
parValue in the call to doStuff = 222;
n1 after function call = 100
n2 after function call = 222


b. parValue in the call to doStuff = 100;
parValue in the call to doStuff = 222;
n1 after function call = 1;
n2 after function call = 2

The omission of the ampersand causes the function’s only action to be the output generated by its output statements. All the rest suggest that a function with call-by-value parameters can cause changes in the argument. This cannot happen.

Computer Science & Information Technology

You might also like to view...

An object's orientation consists of its ____. 

A. UD, LR, and FB B. yaw, pitch, and roll C. subclass and superclass D. position and point of view

Computer Science & Information Technology

To avoid destroying valid output data residing in a buffer, UNIX responds to a write command by marking the appropriate buffer __________.

a. dirty b. active c. inactive d. ready

Computer Science & Information Technology

Pressing ________ on the keyboard will select all contents on a document

A) Ctrl + V B) Ctrl + A C) Ctrl + C D) Ctrl + X

Computer Science & Information Technology

According to the U.S. Bureau of Labor Statistics, what percentage of growth for information security analysts is the available job outlook supposed to reach through 2024?

A. 10 B. 15 C. 18 D. 27

Computer Science & Information Technology