Object-Oriented Programming (OOP): Concepts and Pillars: 21 MCQs with answers
All 21 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 11 questions
Q1. Which statement best describes OOP?
BeginnerShow the answer
A · A paradigm where data and methods are combined into objects
OOP is a programming paradigm based on objects, where data and methods are combined into a single unit.
Q2. In procedural programming, what is emphasised?
BeginnerShow the answer
C · Functions
Procedural programming keeps data and functions separated and emphasises functions.
Q3. How many pillars does OOP have according to the chapter?
BeginnerShow the answer
C · Six
The chapter lists six pillars: Class, Object, Encapsulation, Abstraction, Inheritance, Polymorphism.
Q4. Which of the following is NOT one of the six pillars of OOP?
BeginnerShow the answer
A · Compilation
Compilation is not a pillar. The six pillars are Class, Object, Encapsulation, Abstraction, Inheritance, Polymorphism.
Q5. What is a class?
BeginnerShow the answer
C · A blueprint describing attributes and behaviours
A class is the blueprint of an object; it describes attributes and behaviours but cannot hold data directly.
Q6. What is an object?
BeginnerShow the answer
D · An instance of a class
An object is the instance of a class, created from the class design.
Q7. A red Toyota Corolla and a blue Honda Civic built from the same car design are examples of:
BeginnerShow the answer
B · Objects of the class Car
They are objects created from the class 'Car', each with its own attribute values.
Q8. Which pillar bundles data and methods while restricting direct access?
BeginnerShow the answer
C · Encapsulation
Encapsulation bundles data and methods into a single unit and restricts direct access using access modifiers.
Q9. Which access modifiers are used by encapsulation to hide internal state?
BeginnerShow the answer
D · Private and protected
Encapsulation uses access modifiers such as private and protected to hide internal state.
Q10. Which pillar hides complex implementation details and shows only essential features?
BeginnerShow the answer
C · Abstraction
Abstraction hides complex implementation details and shows only the essential features to the user.
Q11. OOP has six pillars — Class, Object, Encapsulation, Abstraction, Inheritance, and Polymorphism — not the four commonly quoted.
BeginnerShow the answer
A · True
OOP has six pillars — Class, Object, Encapsulation, Abstraction, Inheritance, and Polymorphism — not the four commonly quoted.
Building up · 5 questions
Q12. Pressing the channel button on a remote without knowing the internal circuit is an example of:
IntermediateShow the answer
C · Abstraction
The channel button is an abstraction: you use the essential feature without knowing the complex internals.
Q13. Which mechanism lets a child class acquire properties and methods from a parent class?
IntermediateShow the answer
B · Inheritance
Inheritance is the mechanism where a derived/child class acquires properties and methods from a base/parent class.
Q14. Which relationship does inheritance establish?
IntermediateShow the answer
B · An 'is-a' relationship
Inheritance establishes an 'is-a' relationship, e.g., a sports car is a car.
Q15. Which of these is a type of inheritance named in the chapter?
IntermediateShow the answer
B · Multilevel
The chapter names single, multiple, multilevel, hierarchical, and hybrid inheritance.
Q16. What does polymorphism mean in OOP?
IntermediateShow the answer
D · Expressing various behaviours through the same interface
Polymorphism means 'many forms' — expressing various forms or behaviours through the same interface.
Topper level · 5 questions
Q17. Given the following class structure, identify the correct statement regarding the `SportsCar` class and its relationship with the `Car` class: ```python class Car: def __init__(self, model): self.model = model class SportsCar(Car): def __init__(self, model, speed): super().__init__(model) self.speed = speed ```
AdvancedShow the answer
C · `SportsCar` can access the `model` attribute defined in `Car`.
`SportsCar` inherits from `Car`, allowing it to access the `model` attribute defined in the parent class through the `super()` function.
Q18. Evaluate the following code snippet and determine what will be the output when `my_car` is created: ```python class Car: def __init__(self, model): self.model = model class SportsCar(Car): def __init__(self, model, speed): super().__init__(model) self.speed = speed my_car = SportsCar('Ferrari', 200) print(my_car.model) ```
AdvancedShow the answer
D · 'Ferrari'
The output will be 'Ferrari' because the `model` attribute is correctly initialized in the `Car` class and inherited by `SportsCar`.
Q19. Analyze the following class definitions and determine which statement best describes the relationship between `Animal` and `Dog`: ```python class Animal: def sound(self): return 'Some sound' class Dog(Animal): def sound(self): return 'Bark' ```
AdvancedShow the answer
A · Both classes can have different implementations of the `sound` method.
The `Dog` class successfully overrides the `sound` method from the `Animal` class, allowing for different implementations while maintaining the same interface.
Q20. Consider the implications of encapsulation in the following class design: ```python class BankAccount: def __init__(self, balance): self.__balance = balance def deposit(self, amount): self.__balance += amount def get_balance(self): return self.__balance ``` What is the primary benefit of using the `__balance` attribute with double underscores?
AdvancedShow the answer
D · It restricts access to `__balance`, enhancing data security.
Using double underscores for `__balance` restricts access to the attribute from outside the class, enhancing data security by preventing unauthorized modifications.
Q21. Given the following code snippet, identify the polymorphic behavior demonstrated: ```python class Shape: def area(self): pass class Circle(Shape): def area(self, radius): return 3.14 * radius**2 class Square(Shape): def area(self, side): return side**2 ``` How does this design exemplify polymorphism?
AdvancedShow the answer
C · Both classes implement the same method name but with different parameters.
The design exemplifies polymorphism as both `Circle` and `Square` classes implement the `area` method, allowing different behaviors while using the same interface.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages