Recall & Review
beginner
What is Encapsulation in OOP?
Encapsulation means keeping data (variables) and methods (functions) that work on the data together inside a class. It hides the internal details and only exposes what is necessary.
Click to reveal answer
beginner
Define Inheritance in simple terms.
Inheritance allows a new class to get properties and behaviors from an existing class. It helps reuse code and create a hierarchy.Click to reveal answer
intermediate
What does Polymorphism mean in OOP?
Polymorphism means one action can behave differently based on the object it is acting on. For example, the same method name can do different things in different classes.
Click to reveal answer
intermediate
Explain Abstraction with an example.
Abstraction means showing only the important details and hiding the complex inner workings. For example, when you drive a car, you use the steering wheel without knowing how it works inside.
Click to reveal answer
beginner
List the four main OOP principles.
The four main OOP principles are:<br>1. Encapsulation<br>2. Inheritance<br>3. Polymorphism<br>4. Abstraction
Click to reveal answer
Which OOP principle means hiding internal details and showing only necessary parts?
✗ Incorrect
Abstraction hides complex details and shows only what is needed.
What does inheritance allow a class to do?
✗ Incorrect
Inheritance lets a class reuse properties and methods from a parent class.
Polymorphism allows methods to:
✗ Incorrect
Polymorphism means one method name can work differently depending on the object.
Encapsulation is best described as:
✗ Incorrect
Encapsulation groups data and methods inside a class to protect and organize them.
Which principle helps in creating a class hierarchy?
✗ Incorrect
Inheritance creates a hierarchy by letting classes inherit from others.
Explain the four main OOP principles and give a simple example for each.
Think about how classes hide data, reuse code, behave differently, and hide complexity.
You got /4 concepts.
Why is encapsulation important in programming? How does it help in real-life coding?
Consider how keeping things private helps avoid mistakes.
You got /4 concepts.