All 124 questions
What is polymorphism, and can you explain it with an example?
Asked in 22 of 347 interviews · last asked Oct 22 · Concept · Junior
Show answer
Polymorphism lets you use different implementations through the same interface or base type. With method overriding, the object's actual class determines which method runs at runtime. In Java, method overloading is different: the compiler chooses between methods with different parameter lists using compile-time types.
- An interface or base-class reference can refer to objects of different implementing classes or subclasses.
- Overridden instance methods are selected at runtime.
- Java resolves overloaded methods at compile time, not by the argument object's runtime class.
Codeinterface Animal { void speak(); } class Dog implements Animal { public void speak() { System.out.println("Woof"); } } class Cat implements Animal { public void speak() { System.out.println("Meow"); } } public class Main { public static void main(String[] args) { Animal[] animals = {new Dog(), new Cat()}; for (Animal animal : animals) animal.speak(); // Woof, then Meow } }What the interviewer checks: The interviewer checks whether you understand shared types, runtime method selection, and how overriding differs from overloading.
Common mistake (in 3 of 8 reviewed answers): Many answers forget that the example should use a shared type and show overridden methods being selected at runtime.
Other ways it was asked
- “What is polymorphism?”
- “What is polymorphism in Java?”
- “What is polymorphism in object-oriented programming?”
What are method overloading and method overriding?
Asked in 18 of 347 interviews · last asked Oct 22 · Concept · Junior
Show answer
Method overloading means using the same method name with different parameter lists. Method overriding means a subclass provides a new implementation of an inherited instance method with the same signature. In Java, overload selection happens at compile time, while overridden method selection happens at runtime based on the actual object.
- Overloads differ by parameter count, types, or order; changing only the return type is not enough.
- An override must have a compatible return type and cannot reduce access.
- In Java, final methods cannot be overridden; static methods are hidden, not overridden.
Codeclass Printer { void print(int value) { System.out.println(value); } void print(String value) { System.out.println(value); } // Overloading } class LoudPrinter extends Printer { @Override void print(String value) { // Overriding System.out.println(value.toUpperCase()); } }What the interviewer checks: The interviewer checks whether you understand parameter-based method selection and runtime polymorphism.
Other ways it was asked
- “What is method overriding in Java?”
- “What is method overloading?”
- “What is the difference between method overloading and method overriding?”
What is the difference between an interface and an abstract class?
Asked in 16 of 347 interviews · last asked Oct 21 · Concept · Junior
Show answer
An interface defines a contract that different classes can follow. An abstract class provides a shared base with state and behavior, but cannot be created directly. Use an interface for a common role across unrelated classes, and an abstract class when related classes need shared code or state.
- An abstract class can contain both implemented methods and abstract methods that concrete subclasses must implement.
- In Java, a class can implement multiple interfaces but extend only one class.
- Interface features depend on the language and version; Java 8+ interfaces support default method implementations.
- Abstraction is the idea of hiding details; interfaces and abstract classes are tools for it.
What the interviewer checks: The interviewer checks whether you can choose between a shared contract and a shared base class.
Common mistake (in 3 of 5 reviewed answers): Many answers forget that interfaces suit unrelated classes sharing a contract, while abstract classes suit shared state and behavior.
Other ways it was asked
- “What is the difference between an abstract class and an interface?”
- “What is the difference between an abstract class and an interface, and why would you use an abstract class instead of an interface?”
- “What is the difference between abstraction and an interface?”
What is inheritance in object-oriented programming?
Asked in 14 of 347 interviews · last asked Oct 17 · Concept · Junior
Show answer
Inheritance lets a class build on another class by reusing and extending its behavior. The child class can add features or override methods supported by the language. It is used to model an “is-a” relationship, such as a dog being an animal.
- The existing class is the parent or superclass; the new class is the child or subclass.
- Inheritance supports code reuse and polymorphism.
- Use inheritance for an “is-a” relationship, not just to share code.
- Access rules and support for multiple parent classes depend on the language.
What the interviewer checks: The interviewer is checking whether you understand how inheritance relates classes and when it is appropriate.
Other ways it was asked
- “What is inheritance?”
- “What is the concept of inheritance?”
- “Can you briefly explain the concept of inheritance?”
What is abstraction in object-oriented programming?
Asked in 9 of 347 interviews · last asked Sep 22 · Concept · Junior
Show answer
Abstraction means showing what an object can do without requiring callers to know how it works. It exposes essential operations and leaves out unnecessary details. In Java, interfaces and abstract classes are common ways to define these operations while letting concrete classes provide implementations.
- Callers depend on a clear contract rather than implementation details.
- Different classes can implement the same abstraction in different ways.
- Abstraction focuses on what is exposed; encapsulation controls access to internal state and implementation.
What the interviewer checks: The interviewer checks whether you understand separating an object's public operations from how they are implemented.
Other ways it was asked
- “What is abstraction?”
- “What do you mean by abstraction?”
- “What is abstraction in Java?”
What is an interface in Java?
Asked in 5 of 347 interviews · last asked Sep 30 · Concept · Junior
Show answer
An interface in Java is a type that defines a contract for classes to follow. It lets code use different implementations through the same type, without depending on a specific class. This supports polymorphism and makes implementations easier to replace or test.
- A class uses implements and must implement abstract methods unless the class is abstract.
- A class can implement multiple interfaces.
- Interfaces cannot be instantiated directly.
- Since Java 8, interfaces can also contain default and static methods with bodies.
What the interviewer checks: The interviewer is checking whether you understand interfaces as contracts and how they reduce dependencies on specific classes.
Other ways it was asked
- “What is an interface in Java, and what is it used for?”
- “What advantages do interfaces provide in Java?”
What is inheritance, and what types of inheritance does Java support?
Asked in 4 of 347 interviews · last asked Sep 27 · Concept · Junior
Other ways it was asked
- “Which types of inheritance does Java support?”
- “What is inheritance in Java?”
- “How do you achieve inheritance in Java?”
Can a static method be overridden?
Asked in 4 of 347 interviews · last asked Oct 18 · Concept · Junior
Other ways it was asked
- “Can you override a static method in Java?”
- “Can static methods be overridden?”
- “Why can't static methods be overridden in Java?”
Can you explain how Java handles multiple inheritance?
Asked in 4 of 347 interviews · last asked Oct 8 · Concept · Junior
Other ways it was asked
- “How can you implement multiple inheritance in Java?”
- “How can you achieve multiple inheritance in Java when classes do not support it?”
- “Why does Java not allow multiple inheritance?”
What does the `virtual` keyword do in C#, and when would you use it?
Asked in 3 of 347 interviews · last asked Aug 19 · Concept · Junior
Other ways it was asked
- “What is the virtual keyword used for in C#?”
- “What is the virtual keyword, and why do we use it?”
What is the diamond problem in multiple inheritance?
Asked in 3 of 347 interviews · last asked Oct 9 · Concept · Junior
Other ways it was asked
- “What is the diamond problem in C++ multiple inheritance?”
- “How can the diamond problem in C++ multiple inheritance be handled?”
What are the differences between sealed and non-sealed classes in Java?
Asked in 2 of 347 interviews · last asked Sep 2 · Concept · Mid-level
Other ways it was asked
- “What do sealed classes do in Java?”
What is the difference between an abstract class and a virtual method?
Asked in 2 of 347 interviews · last asked Sep 17 · Concept · Mid-level
Other ways it was asked
- “What is the difference between virtual and abstract classes?”
How does Odoo model inheritance differ from delegation through `_inherits`?
Asked in 2 of 347 interviews · last asked Aug 24 · Concept · Mid-level
Other ways it was asked
- “How does model inheritance work in Odoo's ORM?”
Can methods with the same name and parameters differ only by return type?
Asked in 2 of 347 interviews · last asked Oct 16 · Concept · Junior
Other ways it was asked
- “If two methods have the same name and same parameters but different return types, is it overloading, overriding, or a compilation error?”
- “If two methods have the same name and parameters but different return types, is that compile-time polymorphism?”
What is the purpose of virtual functions in C++?
Asked in 2 of 347 interviews · last asked Oct 9 · Concept · Junior
Other ways it was asked
- “Why would you declare a function as virtual in C++?”
- “What are virtual functions in C++?”
- “When should you use virtual functions in C++?”
Why would you need an abstract class?
Asked in 2 of 347 interviews · last asked May 22 · Concept · Junior
Other ways it was asked
- “What is the purpose of using an abstract class?”
- “How would you use an abstract class in an application, and when would you choose one?”
- “What is an abstract class?”
How does multiple inheritance work in Python?
Asked in 2 of 347 interviews · last asked Sep 4 · Concept · Junior
Other ways it was asked
- “Is multiple inheritance allowed in Python?”
- “How do you implement multilevel inheritance in Python?”
- “What issues can arise from multiple inheritance in Python?”
What is the difference between inheritance and abstraction?
Asked in 2 of 347 interviews · last asked Oct 8 · Concept · Junior
In OOP, what's the difference between abstraction and encapsulation?
Asked in 2 of 347 interviews · last asked Sep 22 · Concept · Junior
Other ways it was asked
- “How is abstraction different from encapsulation?”
What is the meaning of runtime polymorphism?
Asked in 2 of 347 interviews · last asked Oct 16 · Concept · Junior
Other ways it was asked
- “What is the other type of polymorphism besides runtime polymorphism?”
What is the simplest way to add the same five fields to Odoo's Sale Order, PoS Order, and Purchase Order models?
Asked once · last asked Jul 23 · Scenario · Mid-level
Other ways it was asked
- “What is the simplest way to add the same five fields to three Odoo models?”
Can you write a C++ example with classes A and B and a class C that inherits from both?
Asked once · last asked Aug 27 · Write code · Junior
When a derived class B inherits from a base class A, which class's constructor is called first?
Asked once · last asked Oct 16 · Concept · Junior
Other ways it was asked
- “How is the base class A's constructor invoked when constructing a derived class B?”
Why use inheritance instead of copying and pasting code?
Asked once · last asked Jan 27 · Concept · Junior
What are the disadvantages of inheritance?
Asked once · last asked Jan 27 · Concept · Mid-level
When would you use an interface instead of instantiating a concrete class, and what are the main uses of interfaces?
Asked once · last asked Feb 10 · Concept · Mid-level
How do you implement inheritance and composition in Java?
Asked once · last asked Feb 14 · Concept · Mid-level
If IUser inherits from IAccount in C#, where should methods declared in IAccount be implemented: in IUser or in a concrete class?
Asked once · last asked Mar 25 · Concept · Junior
In C#, how does a class implement a method declared in an interface when the interface provides no implementation?
Asked once · last asked Mar 25 · Concept · Junior
What are abstract classes and interfaces in PHP, and when would you use one instead of the other?
Asked once · last asked Mar 27 · Concept · Mid-level
If I have two base classes, each with a method, and a child class needs to use both methods, how can I achieve that?
Asked once · last asked Apr 3 · Concept · Mid-level
How would you declare a Taxi class that inherits from Vehicle?
Asked once · last asked Apr 20 · Write code · Junior
Other ways it was asked
- “What would you type on line 11 to make Taxi inherit from Vehicle?”
Does C# support multiple inheritance of classes, allowing a class to inherit from two base classes?
Asked once · last asked Apr 20 · Concept · Junior
Why use interfaces and abstract classes instead of only concrete classes?
Asked once · last asked Apr 27 · Concept · Junior
Since PHP does not allow two methods with the same name in one class, how can you implement method overloading in PHP? Is there an alternative or a specific magic method for it?
Asked once · last asked May 22 · Concept · Mid-level
How does Go handle inheritance, and can a type be extended?
Asked once · last asked Jun 9 · Concept · Mid-level
What is the difference between interfaces in Go and interfaces in Java?
Asked once · last asked Jun 9 · Concept · Mid-level
What is the relationship between structs and interfaces in Go?
Asked once · last asked Jun 9 · Concept · Mid-level
Besides when they occur, how do compile-time and runtime polymorphism differ in C++?
Asked once · last asked Jul 16 · Concept · Mid-level
What is Python's method resolution order (MRO), and how does it determine which method is called?
Asked once · last asked Jul 16 · Concept · Mid-level
What is the tradeoff of using composition over inheritance, or vice versa?
Asked once · last asked Jul 18 · Concept · Mid-level
Can you give an example of when you would use an abstract model in Odoo?
Asked once · last asked Jul 23 · Concept · Mid-level
Can you tell me the difference between an inner class and a subclass?
Asked once · last asked Jul 24 · Concept · Junior
What is multiple inheritance, and how does Swift address its challenges?
Asked once · last asked Jul 29 · Concept · Junior
In C#, how do you choose between an abstract class and an interface for a domain service contract, especially around versioning and default behavior?
Asked once · last asked Aug 4 · Concept · Senior
When prototypal inheritance is used, how does JavaScript resolve a property lookup across an object's prototype chain, and what happens if a property is shadowed?
Asked once · last asked Aug 11 · Concept · Mid-level
Can you write a real-world example of abstraction?
Asked once · last asked Aug 24 · Concept · Junior
Can you show method overloading in Python using an example and write the code?
Asked once · last asked Aug 24 · Write code · Junior
How can you use None as a default argument to simulate method overloading in Python?
Asked once · last asked Aug 24 · Concept · Junior
Other ways it was asked
- “In a Python method-overloading example, why might None be used, and how does the code implement the overloading?”
When you override create, write, or another method in an Odoo module, how does that work in the ORM?
Asked once · last asked Aug 24 · Concept · Mid-level
How do you override create or write in Odoo's ORM using super(), and why would you do so?
Asked once · last asked Aug 24 · Concept · Mid-level
What is the difference between a marker interface and a functional interface?
Asked once · last asked Sep 4 · Concept · Junior
Does Python support method overloading?
Asked once · last asked Sep 8 · Concept · Mid-level
What code changes are required when adding a new method to a Java interface implemented by many classes?
Asked once · last asked Sep 11 · Scenario · Mid-level
Which OOP principle does virtual method overriding demonstrate?
Asked once · last asked Sep 15 · Concept · Junior
Why might you choose inheritance over composition in software design, and what considerations would inform that decision?
Asked once · last asked Sep 18 · Concept · Mid-level
If a base class has a virtual function named add and a child class defines a non-virtual function with the same name, what happens when you call the function through a base-class handle, and how does the mechanism work?
Asked once · last asked Sep 25 · Concept · Mid-level
Can you write a Python example of inheritance with an `Animal` base class and a `Dog` subclass?
Asked once · last asked Sep 26 · Write code · Junior
What are the different types of methods in a Java interface?
Asked once · last asked Sep 30 · Concept · Junior
Write down a short code example showing an interface and its implementation in C#.
Asked once · last asked Oct 1 · Write code · Junior
When adding a parameter to an existing method, would you change the method or create an overloaded method, and what would guide your choice?
Asked once · last asked Oct 2 · Scenario · Mid-level
Can you give examples of compile-time polymorphism in C++?
Asked once · last asked Oct 9 · Concept · Junior
What is the difference between calling a normal function and a virtual function in C++, and what happens in each case?
Asked once · last asked Oct 9 · Concept · Mid-level
When might inheritance be a poor choice?
Asked once · last asked Oct 12 · Concept · Mid-level
In C++, which class's constructor is called first when a derived class is constructed?
Asked once · last asked Oct 16 · Concept · Junior
How does a compiler find a function in a class hierarchy?
Asked once · last asked Oct 16 · Concept · Senior
What challenges arise when a compiler processes inherited declarations during function lookup?
Asked once · last asked Oct 16 · Concept · Senior
How can a compiler efficiently resolve function lookups across an inheritance hierarchy?
Asked once · last asked Oct 16 · Scenario · Senior
In C#, what is abstraction, and how do you implement it?
Asked once · last asked Jan 26 · Concept · Mid-level
Which C# keywords can you use to implement abstraction in a class?
Asked once · last asked Jan 26 · Concept · Mid-level
What is a sealed class, and how would you use the sealed concept in your application?
Asked once · last asked Jan 26 · Concept · Mid-level
Other ways it was asked
- “Can you give a real-world use case for applying the sealed concept?”
Can an interface have virtual methods in C#?
Asked once · last asked Mar 25 · Concept · Junior
Other ways it was asked
- “Can an interface have abstract methods in C#?”
What is the MRO in Python?
Asked once · last asked Aug 14 · Concept · Junior
Other ways it was asked
- “How does MRO work in Python?”
What do you find challenging or limiting about Java interfaces?
Asked once · last asked Sep 8 · Concept · Junior
What is a base class in C#?
Asked once · last asked Sep 21 · Concept · Junior
Other ways it was asked
- “What is the base class of all classes in C#?”
What benefits does inheritance provide?
Asked once · last asked Jan 27 · Concept · Junior
In Kotlin, where do you specify that a method overrides an inherited method?
Asked once · last asked Feb 10 · Concept · Junior
What does inheritance help with?
Asked once · last asked Mar 10 · Concept · Junior
Can private members of a class be inherited by a subclass?
Asked once · last asked Mar 13 · Concept · Junior
Does inheriting a class with private members cause a compile-time error?
Asked once · last asked Mar 13 · Concept · Junior
If class B inherits from class A, can an object of class B access properties of class A?
Asked once · last asked Mar 13 · Concept · Junior
What is an interface in C#?
Asked once · last asked Mar 25 · Concept · Junior
Can an interface inherit from another interface in C#?
Asked once · last asked Mar 25 · Concept · Junior
Can an abstract class in PHP implement an interface?
Asked once · last asked Mar 27 · Concept · Junior
How does driving a vehicle illustrate abstraction in object-oriented programming?
Asked once · last asked Mar 31 · Concept · Junior
How should email, SMS, and push notification subclasses handle sanitization when the base-class sender already sanitizes messages?
Asked once · last asked Mar 31 · Concept · Mid-level
What does it mean for Taxi to be derived from Vehicle?
Asked once · last asked Apr 20 · Concept · Junior
What are overloaded methods in Java?
Asked once · last asked Apr 23 · Concept · Junior
What is inheritance? Give a small example.
Asked once · last asked May 22 · Concept · Junior
Can you give a real-world example of when an abstract class would be useful?
Asked once · last asked May 22 · Concept · Junior
What is the difference between inheritance and polymorphism?
Asked once · last asked May 28 · Concept · Junior
How many interfaces can a Java class implement?
Asked once · last asked Jun 15 · Concept · Junior
What is a class's interface, and what does it include?
Asked once · last asked Jun 17 · Concept · Junior
In C++, what does a derived class inherit from its base class?
Asked once · last asked Jul 16 · Concept · Junior
Can you tell me about encapsulation and inheritance in OOP?
Asked once · last asked Jul 16 · Concept · Junior
What is the purpose of the `super()` function?
Asked once · last asked Jul 7 · Concept · Junior
Which keyword, `this` or `super`, calls a parent class constructor in Java?
Asked once · last asked Jul 16 · Concept · Junior
Are there any Java classes that do not inherit from Object?
Asked once · last asked Jul 16 · Concept · Junior
Other ways it was asked
- “Which two Java classes do not inherit from `Object`?”
What are abstract classes in Python?
Asked once · last asked Jul 16 · Concept · Junior
What is method dispatch in object-oriented programming?
Asked once · last asked Jul 17 · Concept · Junior
What is the difference between composition and inheritance?
Asked once · last asked Jul 18 · Concept · Junior
How do prototypal inheritance and classes relate in JavaScript?
Asked once · last asked Jul 20 · Concept · Junior
Which classes can be extended in Java?
Asked once · last asked Jul 22 · Concept · Junior
What is multiple inheritance?
Asked once · last asked Jul 26 · Concept · Junior
What is hybrid inheritance?
Asked once · last asked Jul 26 · Concept · Junior
What is multilevel inheritance?
Asked once · last asked Jul 26 · Concept · Junior
From a practical standpoint, why is polymorphism useful in code?
Asked once · last asked Aug 3 · Concept · Junior
How does abstraction support systems like a banking app where users only click buttons without seeing the backend logic?
Asked once · last asked Aug 10 · Concept · Junior
Can you give a simple example of method resolution order in Python?
Asked once · last asked Aug 14 · Concept · Junior
What do you mean by protocol-oriented programming?
Asked once · last asked Aug 17 · Concept · Mid-level
What is an abstract class in object-oriented programming, and how do you define one?
Asked once · last asked Aug 19 · Concept · Junior
Other ways it was asked
- “What is an abstract class in object-oriented programming, and how can we achieve it?”
Can we do multiple inheritance in C++?
Asked once · last asked Aug 27 · Concept · Junior
What is the difference between an interface and its implementation?
Asked once · last asked Sep 19 · Concept · Junior
Why is abstraction used in object-oriented programming?
Asked once · last asked Sep 22 · Concept · Junior
What are the different types of polymorphism?
Asked once · last asked Sep 22 · Concept · Junior
What do we call polymorphism whose behavior is resolved at compile time?
Asked once · last asked Sep 22 · Concept · Junior
What is polymorphism in SystemVerilog?
Asked once · last asked Sep 25 · Concept · Junior
Can you give a practical example of when using an interface in C# is a good design choice?
Asked once · last asked Sep 25 · Concept · Junior
Can an interface have a constructor in Java?
Asked once · last asked Sep 30 · Concept · Junior
What is inheritance in JavaScript?
Asked once · last asked Oct 5 · Concept · Junior
What does `extends` mean in TypeScript and JavaScript?
Asked once · last asked Oct 8 · Concept · Junior
What is a parent class in Java?
Asked once · last asked Oct 10 · Concept · Junior
Why is the base class constructor called before the derived class constructor?
Asked once · last asked Oct 16 · Concept · Junior
More OOP and Design Patterns interview questions
- All OOP and Design Patterns interview questions
- OOP Basics Interview Questions
- SOLID Principles and Object Design Interview Questions
- Dependency Injection and IoC Interview Questions
- Design Patterns Interview Questions
How this list is made
Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.
Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.
The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every OOP and Design Patterns interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.
347 interviews, 240 candidates, Sep 2025 to Oct 2026. Updated every month with new interviews.
Or add the Chrome extension