88 questions in 8 topics
OOPs Basics Interview Questions
The basics placement rounds start with: what OOP is, classes and objects, access modifiers, two output questions.
- What is OOPs (object-oriented programming)?
- What is the difference between object-oriented and procedural programming?
- What is the difference between a class and an object?
- What are the four pillars of OOPs?
Four Pillars of OOPs Interview Questions
One question per pillar with runnable code, plus the comparisons that test whether you understand them.
- What is encapsulation? Explain with an example.
- What is the difference between abstraction and encapsulation?
- What is inheritance, and what types of inheritance does Java support?
- What is polymorphism? What are its types?
Classes, Objects and Constructors Interview Questions
Constructors, initialization order, this and super, static members, copying and cleanup.
- What is a constructor, and how is it different from a method?
- What is constructor overloading and constructor chaining?
- What are the types of constructors? Does Python have a constructor?
- In what order do constructors run in a three-level Java class hierarchy?
Inheritance and Polymorphism Interview Questions
Overloading versus overriding, what is polymorphic in Java, the diamond problem, and the output questions most candidates miss.
- What is the difference between method overloading and method overriding?
- What is operator overloading? Does Java support it?
- Do fields get overridden like methods in Java?
- What happens when a Java subclass redeclares a parent's static method?
Abstraction and Interfaces Interview Questions
Abstract classes, interfaces, functional and marker interfaces, and the Python equivalents.
- What is abstraction in OOPs? Give a real example.
- What is the difference between an abstract class and an interface?
- When should you use an abstract class instead of an interface?
- Does an abstract class constructor ever run in Java?
SOLID Principles and Design Patterns Interview Questions
The five SOLID principles, composition over inheritance, and the common patterns: singleton, factory, strategy, observer, builder.
- What are the SOLID principles?
- Explain the single responsibility principle with an example.
- What is the open/closed principle?
- What does
resize(new Square())print in Java, and which SOLID rule breaks?
OOPs in Java vs Python vs C++
How the same ideas look in Java, Python and C++, with the Python traps as runnable code.
- How is OOP different in Java, Python and C++?
- What is
selfin Python? - Can you read a double-underscore attribute from outside a Python class?
- Is a list declared in a Python class body per object or per class?
Advanced OOPs Interview Questions
Equality contracts, immutability, records and sealed types, dispatch internals and object-oriented design rounds.
- What happens if you override
equals()but nothashCode()in Java? - What is a record in Java, and when should you use one?
- How do you create an immutable class in Java?
- What is the difference between Comparable and Comparator?
Frequently Asked Questions
How should I prepare for an OOPs interview?
Learn each pillar as one sentence plus one example, then the comparisons: abstract class versus interface, overloading versus overriding, composition versus inheritance. Write small programs with constructors, overriding and interfaces and predict their output before running them. For experienced roles add SOLID, five or six design patterns and one design problem such as a parking lot.
What OOPs questions are asked to freshers compared with experienced candidates?
Freshers get definitions and small code: the four pillars, class versus object, constructors, static, access modifiers, overloading versus overriding, and output questions. Experienced candidates are asked why: when to choose composition, how equals and hashCode interact, how to make a class immutable, which pattern fits a problem, and how to design a small system.
Which language should I use to answer OOPs questions?
Use the language on the job description, or your most fluent one. Java is the safest default because its OOP features are explicit: interfaces, access modifiers, abstract, @Override. In Python, be ready to explain the differences: no enforced private members, multiple inheritance with the MRO, and duck typing instead of declared interfaces.
Do freshers need to know design patterns and SOLID?
Usually the five SOLID principles by name with one example each, plus singleton and factory. Deeper pattern questions and design rounds start at about two years of experience. Explaining one pattern well beats listing twenty.
Are OOPs questions enough, or do I also need DSA?
For most software roles OOP is one round, and data structures and algorithms carry more weight. They overlap: linked list and tree problems start with a node class, heap and sorting problems need comparators, and designs like a min stack or a trie are graded on clean classes. Practise the problems linked on this page in your interview language.