CPP Programming MCQs | Page - 1
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.
β
Correct Answer: (D)
All of the above
Q. Implicit return type of a class constructor is:
β
Correct Answer: (B)
class type itself
Q. Which of the following is true about constructors?
1) They cannot be virtual.
2) They cannot be private.
3) They are automatically called by new operator.
β
Correct Answer: (B)
Only 1 and 3
Q. Output of following program?
#include<iostream>
using namespace std;
class Point {
Point() { cout << "Constructor called"; }
}; int main()
{
Point t1;
return 0;
}
β
Correct Answer: (A)
Compiler Error
Q. #include<iostream>
using namespace std;
class Point {
public:
Point() { cout << "Constructor called"; }
};
int main()
{
Point t1, *t2;
return 0;
}
β
Correct Answer: (C)
Constructor called
Q. Which of the following is FALSE about references in C++?
β
Correct Answer: (D)
References cannot refer to constant value
Q. Which of the following functions must use reference?
β
Correct Answer: (B)
Copy Constructor
Jump to