Interview Q&A / Object-Oriented Programming

INTERVIEW Q&A · 69 QUESTIONS

Object-Oriented Programming interview questions

The four pillars, interfaces, abstract classes and design basics.

  1. What is the difference between method overloading and method overriding?

    Overloading means several methods in the same class share a name but take different parameters, and the compiler picks one. Overriding means a subclass gives its own version of a method it inherited, with the same signature, and the JVM picks the version at runtime based on the actual object.

    BeginnerIn-depth3 min read
  2. What is duck typing in Python, and how does it relate to polymorphism?

    Duck typing means an object is accepted if it has the methods you call, regardless of its class. It gives polymorphism without a shared parent or interface.

    BeginnerQuick answer1 min read