1

Output of following C++ program? #include using namespace std; int main() { int x = 10; int& ref = x; ref = 20; cout << "x = " << x << endl ; x = 30; cout << "ref = " << ref << endl; return 0; }

Correct Answer: x = 20; ref = 30

Make the most of this question

This page focuses on one CPP Programming question from Engineering. After checking the answer, return to the topic list to practice more or run a timed set.

CPP Programming MCQ: Output of following C++ program? #include using namespace std; int main() { int x = 10; int& ref = x; ref = 20; cout << "x = " << x << endl ; x = 30; cout << "ref = " << ref << endl; return 0; } | Extra Education