Object Oriented Programming MCQs with Answers
Practice important Object Oriented Programming MCQs with answers and explanations.
Multiple Choice Questions
Q81: In the AmphibiousVehicle example, how many changeGear() methods does it have?
- A: One
- B: Two
- C: Three
- D: Four
View Answer
B
Q82: Fill in the blank: The interaction of objects in a problem domain is known as _______.
- A: Association
- B: Inheritance
- C: Aggregation
- D: Composition
View Answer
A
Q83: What is the problem with the Diamond Problem in multiple inheritance?
- A: Duplicate methods
- B: Increased code reuse
- C: Simplified inheritance
- D: Decreased complexity
View Answer
A
Q84: In a binary association, how many classes are associated?
- A: One
- B: Two
- C: Three
- D: More than three
View Answer
B
Q85: Fill in the blank: Composition represents a relationship where the composed object can’t exist _______ independently.
- A: partially
- B: fully
- C: partially or fully
- D: not
View Answer
B
Q86: In the provided Fish and Woman classes, what method does Mermaid use?
- A: eat()
- B: Float()
- C: swim()
- D: walk()
View Answer
C
Q87: Which class in the Amphibious Vehicle example has methods like Float() and Move()?
- A: Vehicle
- B: LandVehicle
- C: WaterVehicle
- D: AmphibiousVehicle
View Answer
D
Q88: What is a subtype in object-oriented programming?
- A: A class that inherits from another class
- B: A class that cannot be replaced by another class
- C: A class with no operations
- D: A class with only private methods
View Answer
A
Q89: Which class can be replaced by any of its child classes?
- A: Base class
- B: Derived class
- C: Shape class
- D: Menu class
View Answer
B
Q90: In object-oriented modeling, polymorphism refers to:
- A: The existence of multiple classes
- B: The existence of different forms of a single entity
- C: The existence of a single method
- D: The existence of multiple objects
View Answer
B