C++ 1. Given this function: int functionThree(int& v) { v = v * 2; cout << "Var val = " << v << endl; return (v + 1); } What is the output from this code? (Assume it is in main) int v = 5; cout << "Var v = " << v-- << endl; cout << functionThree(v) << endl; cout << "Var v = " << v << endl; _______________________________________________________________________ 2. Given this function: void functionTwo(int val) { cout << "Var val = " << val << endl; val--; cout << "Var val = " << val << endl; } What is the output from this code? (Assume it is in main) int v = 5; cout << "Var v = " << v << endl; functionTwo(v); cout << "Var v = " << v << endl; __________________________________________________________________ 3. Given this function: void functionOne(int v) { v = 10; cout << "Var v = " << v << endl; v = 11; cout << "Var v = " << v << endl; } What is the output from this code? (Assume it is in main) int v = 5; cout << "Var v = " << v << endl; functionOne(v); cout << "Var v = " << v << endl;
C++
1.
Given this function:
int functionThree(int& v)
{
v = v * 2;
cout << "Var val = " << v << endl;
return (v + 1);
}
What is the output from this code? (Assume it is in main)
int v = 5;
cout << "Var v = " << v-- << endl;
cout << functionThree(v) << endl;
cout << "Var v = " << v << endl;
_______________________________________________________________________
2.
Given this function:
void functionTwo(int val)
{
cout << "Var val = " << val << endl;
val--;
cout << "Var val = " << val << endl;
}
What is the output from this code? (Assume it is in main)
int v = 5;
cout << "Var v = " << v << endl;
functionTwo(v);
cout << "Var v = " << v << endl;
__________________________________________________________________
3.
Given this function:
void functionOne(int v)
{
v = 10;
cout << "Var v = " << v << endl;
v = 11;
cout << "Var v = " << v << endl;
}
What is the output from this code? (Assume it is in main)
int v = 5;
cout << "Var v = " << v << endl;
functionOne(v);
cout << "Var v = " << v << endl;

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









