Skip to content

OOPs Interview Questions for Freshers: The Ones Interviewers Actually Ask

OOPs interview questions freshers face: the four pillars explained simply, classes vs objects, constructors, interfaces, and the tricky follow-up differences with answers.

5 min read
Illustration of a desk with four interlocking puzzle blocks, a laptop and a question-mark bookend, representing OOPs interview questions

OOPs interview questions for freshers focus on the four pillars - encapsulation, inheritance, polymorphism and abstraction - plus classes, objects, constructors, interfaces and the differences interviewers love to probe. This guide covers the OOPs interview questions asked most often in campus and entry-level interviews, with short model answers you can say in your own words.

The four pillars (asked in every single interview)

What is encapsulation? Bundling data and the methods that operate on it inside one unit (a class), and hiding the internal state behind controlled access - private fields with public getters and setters. Example: a BankAccount class that never lets you set balance directly, only deposit or withdraw.

What is inheritance? A child class acquiring fields and methods of a parent class, so common code lives in one place. A Car class extends a Vehicle class and gets fuel capacity for free while adding its own behaviour.

What is polymorphism? One name, many forms. Compile-time polymorphism is method overloading (same method name, different parameters). Runtime polymorphism is method overriding (child class redefines a parent method, and the call resolves at runtime based on the actual object).

What is abstraction? Showing only what is necessary and hiding the how. You drive a car through a steering wheel and pedals without knowing the engine internals. In code: abstract classes and interfaces define what a type can do, not how it does it.

A common follow-up: abstraction vs encapsulation? Abstraction hides complexity (what an object does), encapsulation hides data (how its state is protected). Abstraction is a design concept, encapsulation is its implementation mechanism.

Classes, objects and constructors

Class vs object? A class is the blueprint, an object is a live instance built from it. "Student" is a class; the student sitting in the interview is an object.

What is a constructor? A special method that runs when an object is created, used to initialize state. It has the same name as the class and no return type. Know the types: default, parameterized, and copy constructor.

Constructor vs method? A constructor has no return type, is called automatically at object creation, and cannot be overridden. A method has a return type and is called explicitly.

What is a destructor and does Java have one? A destructor releases resources when an object dies (C++ has it explicitly). Java relies on garbage collection instead - a good place to mention that GC is automatic and you cannot force it.

Inheritance questions freshers fumble

Types of inheritance? Single, multilevel, hierarchical, multiple, and hybrid. Then the trap: does Java support multiple inheritance? Not with classes (the diamond problem - ambiguity when two parents define the same method). Java allows it through interfaces, and since Java 8 interface default methods, be ready to explain how conflicts resolve.

What is the diamond problem? Class D inherits from B and C, both of which inherit from A. If B and C both override a method of A, which version does D get? Languages solve it differently: C++ uses virtual inheritance, Java avoids it by disallowing multiple class inheritance.

super keyword? Refers to the immediate parent - used to call the parent's constructor or its version of an overridden method.

Polymorphism deep-dive questions

Overloading vs overriding? Overloading: same name, different parameter lists, same class, resolved at compile time. Overriding: same signature, parent-child classes, resolved at runtime. Interviewers often ask you to write both - practise a two-minute code sample.

What is dynamic method dispatch? A parent reference pointing to a child object: Animal a = new Dog(); a.sound(); calls Dog's sound(). The method is chosen at runtime based on the object, not the reference type. This is how runtime polymorphism actually works in Java.

Can you override a static or private method? No. Static methods belong to the class (they get hidden, not overridden), and private methods are not visible to the child at all.

Abstract classes and interfaces

Abstract class vs interface? An abstract class can have both implemented and abstract methods, constructors, and instance variables; a class extends only one. An interface (traditionally) has only method signatures and constants; a class can implement many. Use an abstract class for closely related types sharing code, an interface for a capability any unrelated class can have.

Can an abstract class have a constructor? Yes - it runs when a child class object is created, even though you cannot instantiate the abstract class directly. This one filters out candidates who memorized definitions without understanding.

Rapid-fire one-liners to revise

  • Association vs aggregation vs composition: association is a loose relationship; aggregation is has-a with independent lifetimes (department and teacher); composition is has-a with shared lifetime (house and rooms).
  • final keyword: final variable cannot change, final method cannot be overridden, final class cannot be extended.
  • this keyword: refers to the current object; used to disambiguate fields and call another constructor.
  • Coupling and cohesion: good design is low coupling (classes independent) and high cohesion (one class, one job).
  • Access modifiers: private, default, protected, public - know the visibility table cold.

After OOP, the next block most panels touch is operating systems. Practice these operating system interview questions next.

Rounding out CS fundamentals for interviews? Add these computer networks interview questions to your prep list.

Frequently asked questions

Are OOPs questions asked in non-CS fresher interviews?

Yes. IT services companies ask the four pillars to any fresher joining a technical role, regardless of branch, because project training assumes it. Non-CS candidates should at least master the pillars with real-life examples.

Which language should I answer OOPs questions in?

The one on your resume. Java and C++ are the most common. Python candidates should know how Python handles the same concepts (no true private, duck typing, multiple inheritance with MRO).

How deep do fresher OOPs interviews go?

Pillars with examples, overloading vs overriding, abstract class vs interface, and one or two code snippets. Design patterns and SOLID are bonus, not expected - but knowing the singleton pattern is a cheap win.

Should I prepare OOPs or DSA first for placements?

DSA decides coding rounds; OOPs decides technical interviews. If your resume says Java or C++, expect OOPs questions in nearly every technical round, so prepare both in parallel.

Sources

Found this useful? Send it on.

WhatsAppLinkedIn

Keep reading