OOP for placements: interview questions by topic
Interviewers use object-oriented questions to find out whether you can explain a concept with a concrete example, not recite its definition. 'What is polymorphism?' is followed by 'show me one', then 'is that compile-time or runtime, and how do you know?'. The pairs are where the marks are: inheritance versus composition, overloading versus overriding, interface versus abstract class, encapsulation versus the access modifiers that implement it, static versus instance members, this versus super.
The questions are language-neutral in intent and language-specific in detail, so the answers below say which behaviour is Java's and which is C++'s wherever they differ — constructors and destructors especially. SOLID principles appear in product-company rounds as 'what is wrong with this class', and the honest answer usually names one principle and one fix.
Two habits carry most of the round. Answer with a two-class example you can write on paper in a minute — a base class, a subclass, one overridden method — and then say what changes at compile time versus runtime. And when asked for a definition, give the definition, the example, and the one mistake people make with it, in that order; interviewers stop asking once they hear the third part.
Each page below covers one concept: the questions interviewers actually ask, answers with short code, the follow-ups, and one question exactly as the diagnostic asks it. The diagnostic draws from every OOP topic in the bank and tells you which concepts you can define but not apply.
OOP topics, one page each
11 of the 15 OOP topics in the bank have a page so far; the diagnostic draws from all 15.
- Inheritance interview questions
Types of inheritance, constructor order, overriding rules, the diamond problem, composition vs inheritance, upcasting and slicing — in Java and C++.
- Polymorphism interview questions
Compile-time vs runtime polymorphism, overloading vs overriding, virtual dispatch, why C++ needs virtual, static methods, virtual destructors — answered.
- Interface vs abstract class interview questions
Interface vs abstract class, when to choose which, default methods, constructors, the two-defaults conflict, marker and functional interfaces.
- Method overloading vs overriding interview questions
Overloading vs overriding, return-type overloads, override rules, which overload the compiler picks, static methods, covariant returns — answered.
- Encapsulation interview questions
Encapsulation vs abstraction, data hiding, getters and setters vs public fields, leaking mutable state, immutable classes, tell-don't-ask.
- SOLID principles interview questions
All five SOLID principles with the violation each prevents — SRP, Open/Closed, Liskov and the square-rectangle trap, ISP, dependency inversion.
- Constructor and destructor interview questions
Default and parameterised constructors, no return type, this() chaining, super() and the missing no-arg constructor, copy constructors, destructors.
- Static vs instance member interview questions
What static means, why static methods can't touch instance fields, static block order, why main is static, static nested classes, hiding.
- Access modifier interview questions
public, private, protected and package-private in one table, protected across packages, top-level class rules, override access, C++ private inheritance.
- this and super keyword interview questions
What this refers to, shadowed fields, this() and super() in constructors, super.method() from an override, passing and returning this, static context.
- Classes and objects interview questions
Class vs object, what a declaration without new does, copying references, pass-by-value, object lifecycle and garbage collection, equals vs ==, records.
One question, exactly as the diagnostic asks it
From the OOP bank — 60 questions across 15 topics. The answer is marked because this one is public; in a sitting you choose first, then see why each option is right or wrong.
What is 'inheritance' in object-oriented programming?
- 1A mechanism where multiple methods share the same name but different parameter lists.
- 2A mechanism where a new class acquires the properties and behavior of an existing class.correct
- 3A mechanism where a class is prevented from being instantiated directly.
- 4A mechanism where an object's internal data is hidden from other classes.
Inheritance lets a derived (child) class reuse and extend fields/methods of a base (parent) class, promoting code reuse and establishing an 'is-a' relationship. Several methods sharing a name with different parameter lists is overloading; hiding an object's internal data from other classes is encapsulation; and preventing a class from being instantiated directly describes an abstract class.
Measure it
Reading the answers tells you what’s true. A diagnostic tells you what you get wrong.
10 OOP questions across its topics, easy to hard, about fifteen minutes. You get a readiness figure with the arithmetic shown, the topics you missed named, and a practice set sized for today. Free: 1 diagnostic a month and 15 problems a day. No card.