Consider a scenario where Class B inherits from Class A, and Class C also inherits from Class A. Class D inherits from both B and C. Which problem does this create?
Q.43Medium
What is the purpose of a destructor in C++?
Q.44Medium
Which of the following is NOT a type of polymorphism in C++?
Q.45Medium
What will be the output of the following code?
class A { public: virtual void func() { cout << "A"; } };
class B : public A { public: void func() { cout << "B"; } };
A *ptr = new B();
ptr->func();
delete ptr;
Advertisement
Q.46Medium
In C++, what is a friend function?
Q.47Hard
What is the difference between shallow copy and deep copy in C++?
Q.48Easy
Which of the following best defines abstraction in OOP?
Q.49Medium
In C++11 and later, what does the 'override' keyword ensure when used with virtual functions?
Q.50Easy
What is the correct syntax for inheriting from multiple base classes in C++?
Q.51Hard
What is a virtual destructor and why is it important?
Q.52Medium
Which of the following statements about constructors in C++ is FALSE?
Q.53Hard
In C++, what does the 'mutable' keyword do when applied to a class member?
Q.54Hard
What is the primary advantage of using interfaces (abstract classes with pure virtual functions) in C++?
Q.55Easy
What is the access specifier for class members that are accessible only within the same class?
Q.56Easy
In C++, when a derived class object is created, which constructor is called first?
Q.57Easy
What does polymorphism literally mean?
Q.58Medium
In C++, what is the default access specifier for class members?
Q.59Medium
What is 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(); }