subject

Consider the following program. Assume all variables are declared and the program compiles. #include
using namespace std;

void getVal(int&, int&);
void procVal(int, int&);

int x;

int main() {
int intNum1;
int intNum2;
x = 6;

getVal(intNum1, intNum2);
cout << intNum1 << " " << intNum2 << " " << x << endl;

procVal(intNum1, intNum2);
cout << intNum1 << " " << intNum2 << " " << x << endl;
return 0;
}
void getVal(int& a, int& b)
{
cout << “Enter value for a: “ << endl;
cin >> a; /// The user enters 1
cout << “Enter value for b: “ << endl;
cin >> b; /// The user enters 2
x = a * b;

}
void procVal(int u, int& v)
{
int intNum3;
intNum3= x;
v = intNum3 * 4;
u = u - v;
}

Answer the following questions:

a. What is the output in the cout statements? Consider variable scope.

b. Considering the function getVal, both parameters are called by reference. What is passed into the function for the parameters, i. e., what do the parameters receive? HINT: Do not write ‘a reference parameter or a reference value’!

c. Considering the function procVal, parameter 1 is called by value. What occurs in memory for parameter 1 and local variable int intNum3? Hint: consider memory, parameters and local variables

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:00
Discuss the ways in which electronic information associated with payments is addressed in terms of security. include encryption, secure sockets layers, and secure electronic transactions in your discussion. are there any other ways that consumers and businesses can keep their payment information secure in an electronic commerce environment? do you feel that your information is safe when conducting electronic business? why or why not?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
question
Computers and Technology, 23.06.2019 12:40
Curriculum exam to process a resident's payment, you must click on onesite payments home page. from the a. reports b. my settings o c.transactions o d. rent tab
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
You know the right answer?
Consider the following program. Assume all variables are declared and the program compiles. #includ...
Questions
question
Mathematics, 30.01.2020 19:59
question
Mathematics, 30.01.2020 20:00
Questions on the website: 13722359