iGET

C++ Programming - MCQ Practice Questions

C++ MCQs — OOP, STL, pointers, templates for coding rounds & IT exams.

100 questions | 100% Free

Q.41Medium

Which of the following is an example of operator overloading as a member function?

Q.42Medium

In which scenario would you use an abstract base class instead of a concrete base class?

Q.43Medium

What will be the output of the following code? class Base { public: void show() { cout << "Base"; } }; class Derived : public Base { public: void show() { cout << "Derived"; } }; int main() { Base *b = new Derived(); b->show(); }

Q.44Medium

Consider a scenario where a derived class needs to access a base class member that should not be accessible to external code. Which access specifier should be used in the base class?

Q.45Medium

What is the output of the following code? class A { public: virtual void func() { cout << "A"; } }; class B : public A { public: void func() { cout << "B"; } }; class C : public B { public: void func() { cout << "C"; } }; int main() { A *p = new C(); p->func(); }

Q.46Medium

Which of the following statements about constructors is correct?

Q.47Medium

What is the primary use of the 'const' keyword when applied to member functions?

Q.48Medium

Which of the following best describes the concept of method overloading?

Q.49Medium

In C++, when a derived class overrides a virtual function from a base class, which access specifier must be used to ensure proper polymorphic behavior?