Home / MCQ Bank / Computer
Computer Pointers And References In C Plus Plus Difficulty: Medium

What will be the output of the following C++ code? #include<iostream> using namespace std; int main() { int x = 10; int& ref = x; ref = 20; cout << x << endl ; x = 30; cout << ref << endl; return 0; }

Select the correct option to test your answer:

More Computer Questions

In C++, if a derived class does not define a constructor, which constructor of the base class is called during the object creation of the derived class? A teleprocessing system may consist of What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { vector<int> myvector (5); fill (myvector.begin(), myvector.begin() + 4, 5); fill (myvector.begin() + 3,myvector.end() - 2, 8); for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it) cout << ' ' << *it; return 0; } What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int x; int *p; x = 5; p = &x; cout << *p; return 0; } Which graph is used to define the claw free graph?