PlacementPrep
Practice › Technical › CSE/IT › C++ and OOP
Technical · CSE / IT

C++ and OOP MCQs for placement tests

20 technical questions of moderate difficulty, as asked in campus placement and company tests. Each has a short explanation.

Q1CSE/IT · C++ and OOPModerate

Which OOP feature allows the same function name to behave differently for different argument types?

Q2CSE/IT · C++ and OOPModerate

What is the output of this C++ program?

#include <iostream>
using namespace std;
class Base { public: Base() { cout << "Base "; } };
class Derived : public Base { public: Derived() { cout << "Derived "; } };
int main() { Derived d; return 0; }
Q3CSE/IT · C++ and OOPModerate

What is the output of this C++ program?

#include <iostream>
using namespace std;
class Base { public: ~Base() { cout << "~Base "; } };
class Derived : public Base { public: ~Derived() { cout << "~Derived "; } };
int main() { { Derived d; } return 0; }
Q4CSE/IT · C++ and OOPModerate

What is the output of this C++ program?

#include <iostream>
using namespace std;
class Base { public: virtual void show() { cout << "Base"; } };
class Derived : public Base { public: void show() override { cout << "Derived"; } };
int main() { Base *b = new Derived(); b->show(); return 0; }
Q5CSE/IT · C++ and OOPModerate

What is the output of this C++ program?

#include <iostream>
using namespace std;
class Base { public: void show() { cout << "Base"; } };
class Derived : public Base { public: void show() { cout << "Derived"; } };
int main() { Base *b = new Derived(); b->show(); return 0; }
Q6CSE/IT · C++ and OOPModerate

A class that contains at least one pure virtual function is called:

Q7CSE/IT · C++ and OOPModerate

Which access specifier makes members accessible in the class and its derived classes, but not outside?

Q8CSE/IT · C++ and OOPModerate

What is the default access specifier for members of a class in C++?

Q9CSE/IT · C++ and OOPModerate

Which keyword lets a function access the private members of a class without being a member?

Q10CSE/IT · C++ and OOPModerate

What is the output of this C++ program?

#include <iostream>
using namespace std;
int add(int a) { return a; }
int add(int a, int b) { return a + b; }
int main() { cout << add(5, 2); return 0; }
Q11CSE/IT · C++ and OOPModerate

What is the output of this C++ program?

#include <iostream>
using namespace std;
int main() { int x = 10; int &r = x; r += 5; cout << x; return 0; }
Q12CSE/IT · C++ and OOPModerate

Wrapping data and the functions that work on it into a single unit is called:

Q13CSE/IT · C++ and OOPModerate

Which type of inheritance can cause the 'diamond problem'?

Q14CSE/IT · C++ and OOPModerate

Which operator cannot be overloaded in C++?

Q15CSE/IT · C++ and OOPModerate

What is a copy constructor used for?

Q16CSE/IT · C++ and OOPModerate

What is the output of this C++ program?

#include <iostream>
using namespace std;
class A { public: static int count; A() { count++; } };
int A::count = 0;
int main() { A a, b; cout << A::count; return 0; }
Q17CSE/IT · C++ and OOPModerate

Which of these is used for dynamic memory allocation in C++?

Q18CSE/IT · C++ and OOPModerate

What does the 'this' pointer point to?

Q19CSE/IT · C++ and OOPModerate

In C++, which container provides fast lookup by key with keys kept in sorted order?

Q20CSE/IT · C++ and OOPModerate

What is the output of this C++ program?

#include <iostream>
#include <vector>
using namespace std;
int main() { vector<int> v = {4, 5, 6}; cout << v.size(); return 0; }

Want guided preparation? Placement Papers Prep courses by Dr. Kiran Derle, with video lessons and full-length mocks.

See placement courses ↗