C++ Questions
What is the output of this program?
-
#include <iostream> -
using namespace std;
-
void copy (int& a, int& b, int& c)
-
{ -
a *= 2;
-
b *= 2;
-
c *= 2;
-
} -
int main ()
-
{ -
int x = 1, y = 3, z = 7;
-
copy (x, y, z);
-
cout << "x =" << x << ", y =" << y << ", z =" << z;
-
return 0;
-
}
a) 2 5 10
b) 2 4 5
c) 2 6 14
d) none of the mentioned
What is the new value of x?
-
#include <iostream> -
using namespace std;
-
void fun(int &x)
-
{ -
x = 20;
-
} -
int main()
-
{ -
int x = 10;
-
fun(x);
-
cout << "New value of x is " << x;
-
return 0;
-
}
a) 10
b) 20
c) 15
d) none of the mentioned
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


