Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
void Sum(int a, int b, int & c)
4.
{
5.
a = b + c;
6.
b = a + c;
7.
c = a + b;
8.
}
9.
int main()
10.
{
11.
int x = 2, y =3;
12.
Sum(x, y, y);
13.
cout
Options:
A .  2 3
B .  6 9
C .  2 15
D .  compile time error
Answer: Option C

We have passed three values and it will manipulate according to the given condition and yield 

the result as 2 15
Output:
$ g++ arg.cpp
$ a.out
2 15



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers