Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
void duplicate (int& a, int& b, int& c)
4.
{
5.
a *= 2;
6.
b *= 2;
7.
c *= 2;
8.
}
9.
int main ()
10.
{
11.
int x = 1, y = 3, z = 7;
12.
duplicate (x, y, z);
13.
cout
Options:
A .  1468
B .  2812
C .  2614
D .  none of the mentioned
Answer: Option C

:We are passing the values by reference and modified the data on the function block.
Output:
$ g++ call1.cpp
$ a.out
2614



Was this answer helpful ?

Submit Solution

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

Latest Videos

Latest Test Papers