Inheritance in Object Oriented Programming (OOPs) MCQ Questions and Answers
Q1. In OOP, “inheritance” primarily promotes which key concept?
A) Encapsulation
B) Code reusability
C) Data hiding
D) Overloading
Answer: B) Code reusability
Q2. The class that is inherited from another class is called:
A) Parent class
B) Base class
C) Derived class
D) Subclass
Answer: B) Base class
Q3. The class that inherits another class is known as:
A) Superclass
B) Base class
C) Subclass
D) Abstract class
Answer: C) Subclass
Q4. Inheritance establishes what kind of relationship between classes?
A) Has-A
B) Uses-A
C) Depends-On
D) Is-A
Answer: D) Is-A
Q5. Which of the following is not a type of inheritance?
A) Single
B) Multiple
C) Multilevel
D) Parallel
Answer: D) Parallel
Q6. Which keyword in C++ is used to define inheritance?
A) extends
B) implements
C) :
D) inherit
Answer: C) :
Q7. In Java, inheritance between classes is achieved using:
A) implements
B) extends
C) super
D) base
Answer: B) extends
Q8. Which type of inheritance is not directly supported in Java?
A) Multilevel
B) Hierarchical
C) Multiple
D) Single
Answer: C) Multiple
Q9. The concept of “inheritance” allows:
A) A subclass to acquire properties of a superclass
B) A superclass to acquire subclass properties
C) Data to be encapsulated
D) Multiple constructors in a class
Answer: A) A subclass to acquire properties of a superclass
Q10. Which of these is true about inherited members in C++?
A) Constructors are inherited
B) Private members are inherited as public
C) Private members are inherited but not accessible directly
D) Static members are not inherited
Answer: C) Private members are inherited but not accessible directly
Q11. Inheritance helps reduce:
A) Time complexity
B) Code redundancy
C) Class hierarchy
D) Memory size
Answer: B) Code redundancy
Q12. Which of the following cannot be inherited?
A) Data members
B) Methods
C) Constructors
D) Static members
Answer: C) Constructors
Q13. What is the base class of all classes in Java?
A) String
B) ObjectBase
C) Base
D) Object
Answer: D) Object
Q14. Which access specifier allows inheritance within the same package only in Java?
A) private
B) default (package-private)
C) protected
D) public
Answer: B) default (package-private)
Q15. In C++, if no access specifier is mentioned for inheritance, it defaults to:
A) private for all classes
B) private for classes, public for structs
C) public for all classes
D) protected for all
Answer: B) private for classes, public for structs
Q16. Which of these is not a valid inheritance type in OOP?
A) Hierarchical
B) Hybrid
C) Circular
D) Multilevel
Answer: C) Circular
Q17. The derived class can:
A) Only add new data members
B) Only override methods
C) Add and override members of the base class
D) None of the above
Answer: C) Add and override members of the base class
Q18. The access specifier that allows visibility to subclasses and same-package classes is:
A) public
B) private
C) protected
D) default
Answer: C) protected
Q19. Inheritance helps achieve:
A) Dynamic typing
B) Polymorphism
C) Encapsulation
D) Static binding
Answer: B) Polymorphism
Q20. When a derived class overrides a method of the base class, it demonstrates:
A) Runtime polymorphism
B) Compile-time polymorphism
C) Static binding
D) Encapsulation
Answer: A) Runtime polymorphism
Q21. Which mechanism allows an object to be treated as an instance of its parent class?
A) Upcasting
B) Downcasting
C) Abstraction
D) Aggregation
Answer: A) Upcasting
Q22. Which function in C++ invokes the parent class constructor?
A) super()
B) Initializer list
C) base()
D) this()
Answer: B) Initializer list
Q23. Which keyword in Java is used to refer to the parent class?
A) base
B) this
C) super
D) parent
Answer: C) super
Q24. Which of the following is true about inheritance in OOP?
A) A derived class can use public and protected members of the base class
B) Private members are always inherited and accessible
C) Derived class cannot add new members
D) Inheritance cannot be transitive
Answer: A) A derived class can use public and protected members of the base class
Q25. The process of redefining a base class method in the derived class is called:
A) Overloading
B) Overriding
C) Hiding
D) Extending
Answer: B) Overriding
Q26. Which inheritance type has one base and one derived class?
A) Multiple
B) Single
C) Hierarchical
D) Multilevel
Answer: B) Single
Q27. Which type of inheritance involves a chain of classes?
A) Multiple
B) Hybrid
C) Multilevel
D) Hierarchical
Answer: C) Multilevel
Q28. In which inheritance do multiple classes derive from a single base class?
A) Hierarchical
B) Hybrid
C) Multilevel
D) Multiple
Answer: A) Hierarchical
Q29. In multiple inheritance, the major ambiguity arises from:
A) Data hiding
B) Diamond problem
C) Method overloading
D) Static binding
Answer: B) Diamond problem
Q30. Which languages avoid the diamond problem using interfaces?
A) C++
B) Java
C) C
D) Python
Answer: B) Java
Q31. When a class inherits multiple base classes, it is called:
A) Multilevel
B) Hybrid
C) Multiple inheritance
D) Hierarchical
Answer: C) Multiple inheritance
Q32. Which of these inheritance types mixes two or more inheritance patterns?
A) Hierarchical
B) Hybrid
C) Multilevel
D) Single
Answer: B) Hybrid
Q33. In hierarchical inheritance, base class acts as:
A) Common ancestor for multiple subclasses
B) Derived class of another
C) Private data holder
D) None
Answer: A) Common ancestor for multiple subclasses
Q34. In C++, virtual inheritance is used to resolve:
A) Overriding
B) Access control
C) Ambiguity in multiple inheritance
D) Typecasting
Answer: C) Ambiguity in multiple inheritance
Q35. Which keyword in C++ is used to implement virtual inheritance?
A) shared
B) extends
C) virtual
D) super
Answer: C) virtual
Q36. Which type of inheritance can cause duplication of base class members?
A) Multiple inheritance
B) Single
C) Multilevel
D) Hierarchical
Answer: A) Multiple inheritance
Q37. Hybrid inheritance may combine:
A) Multilevel and Hierarchical
B) Multiple and Hierarchical
C) Any combination of existing inheritance types
D) None
Answer: C) Any combination of existing inheritance types
Q38. Which of these supports multiple inheritance directly?
A) Java
B) C++
C) C#
D) Kotlin
Answer: B) C++
Q39. In Python, multiple inheritance is supported by:
A) Composition
B) Method Resolution Order (MRO)
C) Abstract classes
D) Polymorphism
Answer: B) Method Resolution Order (MRO)
Q40. When Class A → Class B → Class C exists, what type of inheritance is it?
A) Multilevel
B) Hierarchical
C) Hybrid
D) Multiple
Answer: A) Multilevel
Q41. In which inheritance type can ambiguity in calling base functions occur?
A) Single
B) Multilevel
C) Multiple
D) Hierarchical
Answer: C) Multiple
Q42. Hierarchical inheritance promotes:
A) Multiple polymorphism
B) Code reusability among sibling classes
C) Runtime errors
D) Abstraction
Answer: B) Code reusability among sibling classes
Q43. A hybrid inheritance model that results in a diamond structure is usually resolved using:
A) Templates
B) Virtual inheritance
C) Overriding
D) Friend functions
Answer: B) Virtual inheritance
Q44. Java uses which feature to simulate multiple inheritance?
A) Abstract class
B) Interfaces
C) Generics
D) Packages
Answer: B) Interfaces
Q45. In C++, the order of constructor calls in multilevel inheritance is:
A) Derived → Base
B) Random
C) Base → Derived
D) Depends on compiler
Answer: C) Base → Derived
Q46. Which inheritance type is useful for classifying entities in a taxonomy?
A) Hierarchical
B) Multiple
C) Hybrid
D) Single
Answer: A) Hierarchical
Q47. Which of these can combine both multilevel and multiple inheritance?
A) Hybrid inheritance
B) Hierarchical
C) Single
D) None
Answer: A) Hybrid inheritance
Q48. The most common inheritance type in OOP is:
A) Multiple
B) Hybrid
C) Single
D) Hierarchical
Answer: C) Single
Q49. In C++, ambiguity from multiple inheritance is removed by:
A) Templates
B) Polymorphism
C) Scope resolution operator (::)
D) Abstract class
Answer: C) Scope resolution operator (::)
Q50. Which inheritance model increases design complexity the most?
A) Single
B) Hybrid
C) Hierarchical
D) Multilevel
Answer: B) Hybrid
Q51. Which of the following is true about constructors in inheritance?
A) Constructors are inherited by subclasses.
B) Constructors of base class are called automatically before derived class constructors.
C) Derived class constructors must explicitly call base class constructors.
D) Constructors are not part of inheritance.
Answer: B) Constructors of base class are called automatically before derived class constructors.
Q52. In Java, the first statement of every subclass constructor must be:
A) this()
B) super()
C) return
D) static
Answer: B) super()
Q53. In C++, when is a base class constructor called in inheritance?
A) Before the derived class constructor.
B) After the derived class constructor.
C) Randomly.
D) Only when explicitly invoked.
Answer: A) Before the derived class constructor.
Q54. Which constructor is called first in a multilevel inheritance hierarchy?
A) Top-most base class constructor
B) Intermediate class constructor
C) Derived class constructor
D) Random
Answer: A) Top-most base class constructor
Q55. In C++, the order of destructor calls in inheritance is:
A) Base → Derived
B) Derived → Base
C) Base → Intermediate → Derived
D) Random
Answer: B) Derived → Base
Q56. Which keyword in C++ ensures a base class destructor is called properly during polymorphism?
A) static
B) inline
C) virtual
D) const
Answer: C) virtual
Q57. If a base class destructor is not virtual, deleting a derived object using base pointer may cause:
A) Compilation error
B) Memory leak
C) Overriding error
D) None
Answer: B) Memory leak
Q58. The super() keyword in Java is used to:
A) Access child class data
B) Invoke parent class constructor or method
C) Access static variables
D) Overload a constructor
Answer: B) Invoke parent class constructor or method
Q59. Which method can be overridden in derived class?
A) Static method
B) Non-static, non-final methods
C) Private methods
D) Final methods
Answer: B) Non-static, non-final methods
Q60. Method overriding occurs when:
A) Two methods have same name in same class
B) Two methods have same name but different parameters
C) Subclass defines a method with same signature as base class
D) Method is overloaded
Answer: C) Subclass defines a method with same signature as base class
Q61. Which of these cannot be overridden in Java?
A) Protected methods
B) Static methods
C) Public methods
D) Abstract methods
Answer: B) Static methods
Q62. In C++, to override a method, it must be declared as:
A) inline
B) const
C) virtual
D) friend
Answer: C) virtual
Q63. Which keyword in Java prevents a method from being overridden?
A) static
B) abstract
C) final
D) private
Answer: C) final
Q64. The term “function overriding” is associated with:
A) Compile-time binding
B) Runtime binding
C) Function overloading
D) Templates
Answer: B) Runtime binding
Q65. In C++, a pure virtual function is declared using:
A) virtual void fun();
B) virtual void fun() = 0;
C) abstract void fun();
D) void fun() = 0;
Answer: B) virtual void fun() = 0;
Q66. If a derived class redefines a base class function without using virtual, it causes:
A) Polymorphism
B) Function hiding
C) Runtime binding
D) Constructor chaining
Answer: B) Function hiding
Q67. In Java, a subclass can call the overridden version of its superclass method using:
A) this.method()
B) super.method()
C) parent.method()
D) base.method()
Answer: B) super.method()
Q68. If a derived class does not define a constructor, what happens?
A) Compilation error
B) Base class default constructor is called automatically
C) Derived class fails to compile
D) Undefined behavior
Answer: B) Base class default constructor is called automatically
Q69. In C++, if base constructor requires parameters, derived class must:
A) Use assignment
B) Pass arguments using initializer list
C) Declare them as global
D) Ignore them
Answer: B) Pass arguments using initializer list
Q70. Which among these supports both method overriding and overloading?
A) C
B) C++
C) Pascal
D) COBOL
Answer: B) C++
Q71. Abstract classes are used in inheritance to:
A) Hide data
B) Create multiple objects
C) Provide a base for derived classes to implement missing methods
D) Avoid polymorphism
Answer: C) Provide a base for derived classes to implement missing methods
Q72. The term “constructor chaining” refers to:
A) Sequential calling of constructors in inheritance hierarchy
B) Multiple constructors in one class
C) Destructor call order
D) Recursion
Answer: A) Sequential calling of constructors in inheritance hierarchy
Q73. In multiple inheritance, constructor call order is determined by:
A) Order of declaration
B) Order of base class appearance in derived class definition
C) Alphabetical order
D) Compiler settings
Answer: B) Order of base class appearance in derived class definition
Q74. In Java, which of the following is true about constructor chaining?
A) Base class constructors are never called.
B) It starts from top-most parent class down to child.
C) It works only for static constructors.
D) It must be done manually.
Answer: B) It starts from top-most parent class down to child.
Q75. Which mechanism is used to achieve polymorphism in inheritance?
A) Encapsulation
B) Dynamic method dispatch
C) Static binding
D) Overloading
Answer: B) Dynamic method dispatch
Q76. In Java, if a subclass overrides a method with a broader access modifier, it is:
A) Illegal
B) Allowed
C) Compile-time error
D) Runtime error
Answer: B) Allowed
Q77. Which statement about private inheritance in C++ is true?
A) Public and protected members of base become private in derived class.
B) All members remain public.
C) Constructors are public.
D) Private members become public.
Answer: A) Public and protected members of base become private in derived class.
Q78. What does the protected access specifier ensure in inheritance?
A) Member is visible only to same class.
B) Member is visible to derived classes but not to outside world.
C) Member is private.
D) Member is static.
Answer: B) Member is visible to derived classes but not to outside world.
Q79. In C++, if a function is declared virtual in base, it remains virtual in derived class even if not redeclared.
A) False
B) True
C) Depends on visibility
D) Depends on compiler
Answer: B) True
Q80. The purpose of using virtual inheritance is to:
A) Increase speed
B) Avoid duplication of base class in multiple inheritance
C) Prevent polymorphism
D) Avoid constructors
Answer: B) Avoid duplication of base class in multiple inheritance
Q81. What is the output when a derived class object calls a non-overridden method of base class?
A) Compilation error
B) Base class version is executed
C) Derived version is executed
D) Undefined
Answer: B) Base class version is executed
Q82. The “object slicing” problem occurs when:
A) Derived object is assigned to base object (by value)
B) Base object assigned to derived
C) Polymorphism used
D) Static members used
Answer: A) Derived object is assigned to base object (by value)
Q83. In C#, multiple inheritance is not supported for classes but can be simulated using:
A) Abstract base classes
B) Interfaces
C) Delegates
D) Structs
Answer: B) Interfaces
Q84. Which of the following is true about constructors in Java inheritance?
A) Constructors are inherited.
B) Constructors are not inherited but can be invoked using super().
C) Constructors are abstract.
D) Constructors can be overridden.
Answer: B) Constructors are not inherited but can be invoked using super().
Q85. Which keyword is used in C++ to call a specific base class function hidden by derived class?
A) super
B) base
C) scope resolution (::)
D) virtual
Answer: C) scope resolution (::)
Q86. Which of these is an example of hierarchical inheritance?
A) A→B→C
B) A→B, B→C
C) A→B and A→C
D) A→B and C→D
Answer: C) A→B and A→C
Q87. The Liskov Substitution Principle applies most closely to:
A) Encapsulation
B) Inheritance and polymorphism
C) Function overloading
D) Static typing
Answer: B) Inheritance and polymorphism
Q88. What is the relationship between “composition” and “inheritance”?
A) Composition replaces inheritance
B) Composition is ‘has-a’, inheritance is ‘is-a’
C) Both are same
D) Inheritance is stronger
Answer: B) Composition is ‘has-a’, inheritance is ‘is-a’
Q89. In Java, when a method is marked as final, it means:
A) Method can be overloaded
B) Method is private
C) Method cannot be overridden
D) Method can be called only once
Answer: C) Method cannot be overridden
Q90. Which of the following statements about multiple inheritance in Python is true?
A) Python resolves ambiguity using MRO and C3 linearization.
B) Python does not support multiple inheritance.
C) Python requires interfaces for it.
D) It results in compile-time errors.
Answer: A) Python resolves ambiguity using MRO and C3 linearization.
Q91. In C++, base class constructor parameters can be passed by:
A) Member initialization list
B) Constructor initializer list in derived class
C) Using friend functions
D) Default arguments
Answer: B) Constructor initializer list in derived class
Q92. What happens if two base classes have same function name and derived class inherits both?
A) Derived class fails to compile
B) Ambiguity arises; must use scope resolution
C) Last declared function wins
D) Random binding
Answer: B) Ambiguity arises; must use scope resolution
Q93. The keyword extends in Java is used for:
A) Class inheritance
B) Interface implementation
C) Composition
D) Importing packages
Answer: A) Class inheritance
Q94. In C++, which inheritance mode allows derived class to access protected members of base class but not expose them publicly?
A) Public
B) Protected
C) Private
D) Virtual
Answer: B) Protected
Q95. The instanceof operator in Java is used to:
A) Declare inheritance
B) Check if an object is an instance of a class or subclass
C) Create inheritance hierarchy
D) Overload constructors
Answer: B) Check if an object is an instance of a class or subclass
Q96. Which of the following statements about abstract base classes in C++ is true?
A) They cannot be instantiated directly.
B) They cannot have constructors.
C) They must have virtual destructors.
D) They must be templates.
Answer: A) They cannot be instantiated directly.
Q97. When a subclass adds new fields not in parent class, it:
A) Breaks inheritance
B) Extends functionality
C) Causes ambiguity
D) Overloads constructor
Answer: B) Extends functionality
Q98. Which of the following results from improper use of multiple inheritance?
A) Overloading
B) Diamond problem
C) Overriding
D) Encapsulation
Answer: B) Diamond problem
Q99. Which of the following is the most accurate description of inheritance?
A) A mechanism to derive a new class from an existing class
B) Copying code from one class to another
C) A way to restrict access
D) Static linkage between classes
Answer: A) A mechanism to derive a new class from an existing class
Q100. In OOP, inheritance combined with polymorphism primarily supports:
A) Code extensibility and dynamic behavior
B) Compile-time optimization
C) Data encapsulation
D) Namespace separation
Answer: A) Code extensibility and dynamic behavior
