All 124 questions

  1. 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.
    Code
    interface 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?”
  2. 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.
    Code
    class 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?”
  3. 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?”
  4. 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?”
  5. 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?”
  6. 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?”
  7. 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?”
  8. 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?”
  9. 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?”
  10. 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?”
  11. 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?”
  12. 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?”
  13. 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?”
  14. 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?”
  15. 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?”
  16. 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++?”
  17. 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?”
  18. 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?”
  19. What is the difference between inheritance and abstraction?

    Asked in 2 of 347 interviews · last asked Oct 8 · Concept · Junior

  20. 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?”
  21. 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?”
  22. 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?”
  23. 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

  24. 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?”
  25. Why use inheritance instead of copying and pasting code?

    Asked once · last asked Jan 27 · Concept · Junior

  26. What are the disadvantages of inheritance?

    Asked once · last asked Jan 27 · Concept · Mid-level

  27. 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

  28. How do you implement inheritance and composition in Java?

    Asked once · last asked Feb 14 · Concept · Mid-level

  29. 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

  30. 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

  31. 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

  32. 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

  33. 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?”
  34. Does C# support multiple inheritance of classes, allowing a class to inherit from two base classes?

    Asked once · last asked Apr 20 · Concept · Junior

  35. Why use interfaces and abstract classes instead of only concrete classes?

    Asked once · last asked Apr 27 · Concept · Junior

  36. 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

  37. How does Go handle inheritance, and can a type be extended?

    Asked once · last asked Jun 9 · Concept · Mid-level

  38. What is the difference between interfaces in Go and interfaces in Java?

    Asked once · last asked Jun 9 · Concept · Mid-level

  39. What is the relationship between structs and interfaces in Go?

    Asked once · last asked Jun 9 · Concept · Mid-level

  40. Besides when they occur, how do compile-time and runtime polymorphism differ in C++?

    Asked once · last asked Jul 16 · Concept · Mid-level

  41. 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

  42. What is the tradeoff of using composition over inheritance, or vice versa?

    Asked once · last asked Jul 18 · Concept · Mid-level

  43. Can you give an example of when you would use an abstract model in Odoo?

    Asked once · last asked Jul 23 · Concept · Mid-level

  44. Can you tell me the difference between an inner class and a subclass?

    Asked once · last asked Jul 24 · Concept · Junior

  45. What is multiple inheritance, and how does Swift address its challenges?

    Asked once · last asked Jul 29 · Concept · Junior

  46. 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

  47. 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

  48. Can you write a real-world example of abstraction?

    Asked once · last asked Aug 24 · Concept · Junior

  49. Can you show method overloading in Python using an example and write the code?

    Asked once · last asked Aug 24 · Write code · Junior

  50. 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?”
  51. 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

  52. 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

  53. What is the difference between a marker interface and a functional interface?

    Asked once · last asked Sep 4 · Concept · Junior

  54. Does Python support method overloading?

    Asked once · last asked Sep 8 · Concept · Mid-level

  55. 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

  56. Which OOP principle does virtual method overriding demonstrate?

    Asked once · last asked Sep 15 · Concept · Junior

  57. 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

  58. 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

  59. 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

  60. What are the different types of methods in a Java interface?

    Asked once · last asked Sep 30 · Concept · Junior

  61. Write down a short code example showing an interface and its implementation in C#.

    Asked once · last asked Oct 1 · Write code · Junior

  62. 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

  63. Can you give examples of compile-time polymorphism in C++?

    Asked once · last asked Oct 9 · Concept · Junior

  64. 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

  65. When might inheritance be a poor choice?

    Asked once · last asked Oct 12 · Concept · Mid-level

  66. In C++, which class's constructor is called first when a derived class is constructed?

    Asked once · last asked Oct 16 · Concept · Junior

  67. How does a compiler find a function in a class hierarchy?

    Asked once · last asked Oct 16 · Concept · Senior

  68. What challenges arise when a compiler processes inherited declarations during function lookup?

    Asked once · last asked Oct 16 · Concept · Senior

  69. How can a compiler efficiently resolve function lookups across an inheritance hierarchy?

    Asked once · last asked Oct 16 · Scenario · Senior

  70. In C#, what is abstraction, and how do you implement it?

    Asked once · last asked Jan 26 · Concept · Mid-level

  71. Which C# keywords can you use to implement abstraction in a class?

    Asked once · last asked Jan 26 · Concept · Mid-level

  72. 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?”
  73. 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#?”
  74. 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?”
  75. What do you find challenging or limiting about Java interfaces?

    Asked once · last asked Sep 8 · Concept · Junior

  76. 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#?”
  77. What benefits does inheritance provide?

    Asked once · last asked Jan 27 · Concept · Junior

  78. In Kotlin, where do you specify that a method overrides an inherited method?

    Asked once · last asked Feb 10 · Concept · Junior

  79. What does inheritance help with?

    Asked once · last asked Mar 10 · Concept · Junior

  80. Can private members of a class be inherited by a subclass?

    Asked once · last asked Mar 13 · Concept · Junior

  81. Does inheriting a class with private members cause a compile-time error?

    Asked once · last asked Mar 13 · Concept · Junior

  82. 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

  83. What is an interface in C#?

    Asked once · last asked Mar 25 · Concept · Junior

  84. Can an interface inherit from another interface in C#?

    Asked once · last asked Mar 25 · Concept · Junior

  85. Can an abstract class in PHP implement an interface?

    Asked once · last asked Mar 27 · Concept · Junior

  86. How does driving a vehicle illustrate abstraction in object-oriented programming?

    Asked once · last asked Mar 31 · Concept · Junior

  87. 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

  88. What does it mean for Taxi to be derived from Vehicle?

    Asked once · last asked Apr 20 · Concept · Junior

  89. What are overloaded methods in Java?

    Asked once · last asked Apr 23 · Concept · Junior

  90. What is inheritance? Give a small example.

    Asked once · last asked May 22 · Concept · Junior

  91. Can you give a real-world example of when an abstract class would be useful?

    Asked once · last asked May 22 · Concept · Junior

  92. What is the difference between inheritance and polymorphism?

    Asked once · last asked May 28 · Concept · Junior

  93. How many interfaces can a Java class implement?

    Asked once · last asked Jun 15 · Concept · Junior

  94. What is a class's interface, and what does it include?

    Asked once · last asked Jun 17 · Concept · Junior

  95. In C++, what does a derived class inherit from its base class?

    Asked once · last asked Jul 16 · Concept · Junior

  96. Can you tell me about encapsulation and inheritance in OOP?

    Asked once · last asked Jul 16 · Concept · Junior

  97. What is the purpose of the `super()` function?

    Asked once · last asked Jul 7 · Concept · Junior

  98. Which keyword, `this` or `super`, calls a parent class constructor in Java?

    Asked once · last asked Jul 16 · Concept · Junior

  99. 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`?”
  100. What are abstract classes in Python?

    Asked once · last asked Jul 16 · Concept · Junior

  101. What is method dispatch in object-oriented programming?

    Asked once · last asked Jul 17 · Concept · Junior

  102. What is the difference between composition and inheritance?

    Asked once · last asked Jul 18 · Concept · Junior

  103. How do prototypal inheritance and classes relate in JavaScript?

    Asked once · last asked Jul 20 · Concept · Junior

  104. Which classes can be extended in Java?

    Asked once · last asked Jul 22 · Concept · Junior

  105. What is multiple inheritance?

    Asked once · last asked Jul 26 · Concept · Junior

  106. What is hybrid inheritance?

    Asked once · last asked Jul 26 · Concept · Junior

  107. What is multilevel inheritance?

    Asked once · last asked Jul 26 · Concept · Junior

  108. From a practical standpoint, why is polymorphism useful in code?

    Asked once · last asked Aug 3 · Concept · Junior

  109. 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

  110. Can you give a simple example of method resolution order in Python?

    Asked once · last asked Aug 14 · Concept · Junior

  111. What do you mean by protocol-oriented programming?

    Asked once · last asked Aug 17 · Concept · Mid-level

  112. 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?”
  113. Can we do multiple inheritance in C++?

    Asked once · last asked Aug 27 · Concept · Junior

  114. What is the difference between an interface and its implementation?

    Asked once · last asked Sep 19 · Concept · Junior

  115. Why is abstraction used in object-oriented programming?

    Asked once · last asked Sep 22 · Concept · Junior

  116. What are the different types of polymorphism?

    Asked once · last asked Sep 22 · Concept · Junior

  117. What do we call polymorphism whose behavior is resolved at compile time?

    Asked once · last asked Sep 22 · Concept · Junior

  118. What is polymorphism in SystemVerilog?

    Asked once · last asked Sep 25 · Concept · Junior

  119. 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

  120. Can an interface have a constructor in Java?

    Asked once · last asked Sep 30 · Concept · Junior

  121. What is inheritance in JavaScript?

    Asked once · last asked Oct 5 · Concept · Junior

  122. What does `extends` mean in TypeScript and JavaScript?

    Asked once · last asked Oct 8 · Concept · Junior

  123. What is a parent class in Java?

    Asked once · last asked Oct 10 · Concept · Junior

  124. 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

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.