Object Oriented Programming MCQs with Answers
Practice important Object Oriented Programming MCQs with answers and explanations.
Multiple Choice Questions
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
View Answer
D
Q92: The Shape class in the given model is a:
- A: Base class
- B: Child class
- C: Composite class
- D: Leaf class
View Answer
A
Q93: The View class is associated with:
- A: Only shapes
- B: Only menus
- C: Shapes and menus
- D: Only groups
View Answer
A
Q94: The Menu class can send messages to:
- A: The View class
- B: The Shape class
- C: The Group class
- D: The Line class
View Answer
A
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
View Answer
A
Q96: In the graphic editor model, which object can be grouped with other shapes?
- A: Line
- B: Circle
- C: Shape
- D: Group
View Answer
D
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
View Answer
A
Q98: The attribute 'radius' is associated with which class?
- A: Line
- B: Circle
- C: Triangle
- D: Shape
View Answer
B
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
View Answer
A
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
View Answer
A