Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include<iostream> using namespace std; void fn(int& a, int& b) { a = 10; b = 20

ID: 3839740 • Letter: #

Question

#include<iostream>

using namespace std;

void fn(int& a, int& b)

{

       a = 10;

       b = 20;

}

int main()

{

       int nValue1 = 1;

       int nValue2 = 2;

      

       fn(nValue1, nValue2);

      

       cout << " nValue1 = " << nValue1 << endl;

       cout << " nValue2 = " << nValue2 << endl;

       return 0;

}

what are the values of nValue1 and nValue2 after running the program above

20, 10

2, 1

10,   20

2, 1

a.

20, 10

b.

2, 1

c.

10,   20

d.

2, 1

Explanation / Answer

C 10, 20

As the nValue1 and nValue2 are passed by reference , values of nValue1 and nValue2 are changed .