Home / Engineering / CPP Programming MCQs / Page 2
CPP Programming MCQs | Page - 2
Dear candidates you will find MCQ questions of CPP Programming here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
M
Q. 11) Output of following C++ program?
#include<iostream>
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;
}
M
Q. 12) What is the difference between struct and class in C++?
M
Q. 13) Predict the output of following C++ program.
#include<iostream>
using namespace std;
class Empty {};
int main() {
cout << sizeof(Empty);
return 0;
}
M
Q. 14) class Test {
int x;
};
int main() {
Test t;
cout << t.x;
return 0;
}
M
Q. 16) A member function can always access the data in __________, (in C++).
M
Q. 17) Which of the following is not correct for virtual function in C++?
M
Q. 18) Which of the following is not correct (in C++)?
1. Class templates and function templates are instantiated in the same way
2. Class templates differ from function templates in the way they are initiated
3. Class template is initiated by defining an object using the template argument
4. Class templates are generally used for storage classes
M
Q. 19) Which of the following cannot be passed to a function in C++?
M
Q. 20) Which of the following, in C++, is inherited in a derived class from base class?
Explore More Categories
Click on category to learn MCQs of that category.Electronics and Communication Engineering