Abstract Classes and Interfaces – MCQs July 22, 2025 by u930973931_answers 30 Score: 0 Attempted: 0/30 Subscribe 1. : What is the purpose of an abstract class? (A) To create objects directly (B) To provide a blueprint for derived classes (C) To hold only static members (D) To overload operators 2. : Which of the following cannot be instantiated? (A) Concrete class (B) Static class (C) Abstract class (D) Final class 3. : Which keyword is used to define an abstract class in C++? (A) virtual (B) static (C) abstract (D) There is no specific keyword 4. : What must a class contain to be considered abstract in C++? (A) A static method (B) A virtual destructor (C) At least one pure virtual function (D) A constructor 5. : An abstract class is primarily used to: (A) Improve memory management (B) Provide default implementations (C) Enforce a contract for derived classes (D) Replace constructors 6. : Interfaces in object-oriented programming represent: (A) Abstract data types (B) Concrete base classes (C) Static classes (D) File headers 7. : Which of the following can be part of an interface? (A) Constructors (B) Pure virtual functions (C) Destructors (D) Member variables 8. : In C++, an interface is typically represented as: (A) A static class (B) A class with only static methods (C) A class with all pure virtual functions (D) A namespace 9. : Abstract classes can have: (A) Only pure virtual functions (B) Only concrete methods (C) Both pure virtual and concrete methods (D) Only data members 10. : Which of the following is true for an interface? (A) It allows implementation code (B) It cannot be inherited (C) It defines only method signatures (D) It supports multiple inheritance in C++ 11. : What does a pure virtual function end with in C++? (A) = 0 (B) = 1 (C) nullptr (D) virtual 12. : Interfaces are useful because they enable: (A) File management (B) Memory allocation (C) Polymorphism (D) Pointer arithmetic 13. : Why can’t you create an object of an abstract class? (A) It has no memory (B) It contains incomplete implementation (C) It’s private (D) It’s static 14. : Which one is not a feature of abstract classes? (A) Can’t have constructors (B) Can’t be instantiated (C) Can have data members (D) Can have implemented methods 15. : When a class inherits from an abstract class, it must: (A) Override all functions (B) Declare itself static (C) Provide definitions for pure virtual functions (D) Use the static keyword 16. : An interface can be considered as: (A) A complete implementation (B) A base class with no members (C) A contract specifying what a class should do (D) A namespace 17. : What happens if a derived class doesn’t implement all pure virtual functions of the base class? (A) It gets compiled with warnings (B) It becomes abstract (C) It’s deleted (D) It throws runtime errors 18. : Which class type is commonly used as a base for polymorphic behavior? (A) Static (B) Final (C) Abstract (D) Private 19. : An abstract class can: (A) Contain only static methods (B) Contain non-virtual methods (C) Contain templates only (D) Be instantiated directly 20. : The main advantage of using interfaces is: (A) Increased execution speed (B) Multiple inheritance support (C) Improved security (D) Automatic memory management 21. : What is required in C++ to create an interface-like structure? (A) Class with all virtual functions (B) Class with all pure virtual functions (C) Class with all static functions (D) Final class 22. : Can abstract classes have constructors? (A) Yes (B) No (C) Only protected constructors (D) Only default constructors 23. : What kind of function must be present in an abstract class in C++? (A) Inline function (B) Pure virtual function (C) Static function (D) Friend function 24. : Interfaces help in: (A) Reducing database size (B) Defining a set of operations (C) Compiling faster (D) Increasing disk space 25. : What is not allowed in an interface? (A) Virtual functions (B) Data members (C) Method signatures (D) Public access 26. : Which feature makes polymorphism possible using abstract classes? (A) Static binding (B) Multiple inheritance (C) Virtual functions (D) Destructors 27. : If a class inherits from multiple interfaces, this is called: (A) Hybrid inheritance (B) Single inheritance (C) Interface-based inheritance (D) Multiple inheritance 28. : Can abstract classes be inherited? (A) No (B) Only once (C) Yes (D) Only if they are final 29. : What happens when an object of a class implementing an interface is created? (A) All interface methods are overridden (B) Compiler generates an error (C) It becomes an abstract class (D) The interface is removed 30. : Abstract classes promote: (A) Code duplication (B) Code hiding (C) Code reusability and extensibility (D) Execution speed