Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Chapter: 5
Q81:
In the AmphibiousVehicle example, how many changeGear() methods does it have?
A. One
B. Two
C. Three
D. Four
Correct Answer: B
Chapter: 5
Q82:
Fill in the blank: The interaction of objects in a problem domain is known as _______.
A. Association
B. Inheritance
C. Aggregation
D. Composition
Correct Answer: A
Chapter: 5
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
Correct Answer: A
Chapter: 5
Q84:
In a binary association, how many classes are associated?
A. One
B. Two
C. Three
D. More than three
Correct Answer: B
Chapter: 5
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
Correct Answer: B
Chapter: 5
Q86:
In the provided Fish and Woman classes, what method does Mermaid use?
A. eat()
B. Float()
C. swim()
D. walk()
Correct Answer: C
Chapter: 5
Q87:
Which class in the Amphibious Vehicle example has methods like Float() and Move()?
A. Vehicle
B. LandVehicle
C. WaterVehicle
D. AmphibiousVehicle
Correct Answer: D
Chapter: 6
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
Correct Answer: A
Chapter: 6
Q89:
Which class can be replaced by any of its child classes?
A. Base class
B. Derived class
C. Shape class
D. Menu class
Correct Answer: B
Chapter: 6
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
Correct Answer: B
Chapter: 6
Q91:
Polymorphism allows the sender of a message to know:
A. The exact class of the receiver
B. The approximate class of the receiver
C. The type of method to be called
D. Nothing about the receiver class
Correct Answer: D
Chapter: 6
Q92:
The Shape class in the given model is a:
A. Base class
B. Child class
C. Composite class
D. Leaf class
Correct Answer: A
Chapter: 6
Q93:
The View class is associated with:
A. Only shapes
B. Only menus
C. Shapes and menus
D. Only groups
Correct Answer: A
Chapter: 6
Q94:
The Menu class can send messages to:
A. The View class
B. The Shape class
C. The Group class
D. The Line class
Correct Answer: A
Chapter: 6
Q95:
Polymorphism allows for:
A. Adding new classes without modifying existing models
B. Removing existing classes without affecting the model
C. Changing operations without affecting the model
D. None of the above
Correct Answer: A
Chapter: 6
Q96:
In the graphic editor model, which object can be grouped with other shapes?
A. Line
B. Circle
C. Shape
D. Group
Correct Answer: D
Chapter: 6
Q97:
The operations of the Shape class include:
A. Draw, Select, Move, Rotate
B. Draw, Print, Move, Rotate
C. Draw, Move, Resize, Rotate
D. Draw, Select, Print, Resize
Correct Answer: A
Chapter: 6
Q98:
The attribute 'radius' is associated with which class?
A. Line
B. Circle
C. Triangle
D. Shape
Correct Answer: B
Chapter: 6
Q99:
Fill in the blank: A class that can handle all operations of another class and can be replaced by it is called a _______.
A. subtype
B. superclass
C. interface
D. derived class
Correct Answer: A
Chapter: 6
Q100:
Fill in the blank: In object-oriented modeling, the relationship between a View and the shapes it contains is an example of _______.
A. Aggregation
B. Composition
C. Inheritance
D. Association
Correct Answer: A

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now