Oops in Just 15 Days
Oops in Just 15 Days
01
Days 4-6: Classes and Objects
02
Days 7-9: Inheritance and Polymorphism
03
Days 10-12: Encapsulation and Abstraction
04
Days 13-15: OOP in Practice
05
OOPs Important Interview Questions
Q 1. What is object-oriented programming (OOPs)?
Ans: Object-Oriented Programming (OOP) is a
programming paradigm that organizes code into
objects, which are instances of classes.
Q 3. What is inheritance?
Ans: Inheritance is a mechanism where a new class
(subclass or derived class) inherits properties and
behaviors from an existing class (superclass or base
class).
06
Q 4. What is polymorphism?
Ans: Polymorphism allows objects of different classes to
be treated as instances of a common superclass.
Q 5. What is a constructor?
Ans: A constructor is a special method that is
automatically called when an object is created.
07
Q 6. What is method overloading?
Ans: Method overloading is the ability to define multiple
methods in a class with the same name but different
parameter lists.
08
Q 9. What is an interface?
Ans: An interface is a contract that defines a set of
methods that a class must implement.
09
Q 11. What is a final class?
Ans: A final class is a class that cannot be subclassed. It
prevents other classes from extending it and
inheriting its behavior.
10
Q 14. What is method hiding?
Ans: Method hiding is a concept in object-oriented
programming where a subclass defines a method
with the same name as a method in its superclass,
but the subclass method doesn't override the
superclass method.
11
Q 16. What is the diamond problem in multiple
inheritance?
Ans: The diamond problem occurs in languages that
support multiple inheritance, where a class inherits
from two classes that have a common base class.
12
Q 18. What is a virtual method?
Ans: A virtual method is a method declared in a base class
that can be overridden by its subclasses. The actual
implementation invoked is determined by the
runtime type of the object, supporting
polymorphism.
13
03
Q 21. What is the SOLID principle?
Ans: The SOLID principle is an acronym for a set of design
principles that promote maintainable and scalable
code:
14
Q 23. How is encapsulation related to data hiding?
Ans: Encapsulation involves bundling data and methods
together.
15