Object Oriented Programming MCQs with Answers
Practice important Object Oriented Programming MCQs with answers and explanations.
Multiple Choice Questions
Q101: The Menu class in the model has which attribute?
- A: Name
- B: Color
- C: Vertices
- D: Length
View Answer
A
Q102: Fill in the blank: The Shape class has the following operations: draw, select, move, and _______.
- A: rotate
- B: add
- C: remove
- D: group
View Answer
D
Q103: Fill in the blank: The View class in the graphic editor model can _______ shapes.
- A: Add
- B: Remove
- C: Select
- D: All of the above
View Answer
D
Q104: The Group class inherits attributes from:
- A: The Shape class
- B: The Menu class
- C: The Line class
- D: The View class
View Answer
A
Q105: In C++, a class is used to _______.
- A: define a new data type
- B: calculate mathematical operations
- C: handle file input/output
- D: manage system resources
View Answer
A
Q106: Which of the following is true about classes in C++?
- A: A class can be defined to include both data members and methods.
- B: A class cannot include methods.
- C: A class only includes methods, not data members.
- D: A class can only be used to define primitive data types.
View Answer
A
Q107: An object in C++ is an _______ of a class.
- A: instance
- B: attribute
- C: method
- D: operation
View Answer
A
Q108: When defining a class, the keyword 'public' means that members are _______.
- A: accessible only within the class
- B: accessible from outside the class
- C: accessible only by friend classes
- D: accessible only by derived classes
View Answer
B
Q109: In C++, the default access specifier for class members is _______.
- A: private
- B: protected
- C: public
- D: none
View Answer
A
Q110: To access members of a class through a pointer, which operator is used?
- A: .
- B: ->
- C: ::
- D: &
View Answer
B