OOPS Interview Questions
OOPS Interview Questions
objects, which can contain data in the form of fields (attributes or properties) and code in the form of
1. Encapsulation: Bundling data and methods operating on the data within one unit (class).
A: A class is a blueprint or prototype that defines the properties and behaviors of objects. An object
is an instance of a class that represents an entity in the real world with specific attributes and
behavior.
A: Inheritance is a mechanism in OOP that allows a class (child class) to inherit properties and
methods from another class (parent class). It promotes code reuse and establishes a relationship
between classes.
Q: What is polymorphism?
A: Polymorphism means 'many forms' and allows a single function or method to work in different
ways depending on the context. It can be achieved through method overloading and overriding.
Q: What is encapsulation?
A: Encapsulation is the concept of wrapping data (variables) and methods (functions) into a single
unit (class). It restricts direct access to some of the object's components, promoting controlled
Q: What is abstraction?
A: Abstraction is the process of hiding implementation details and exposing only the necessary
A: Method overloading occurs when two or more methods in the same class have the same name
but different parameters. Method overriding occurs when a subclass provides a specific
Q: What is a constructor?
A: An abstract class can have both abstract (without implementation) and concrete methods (with
implementation), while an interface can only have abstract methods (in most languages). A class
can inherit from one abstract class but implement multiple interfaces.