Top 5 Object Oriented Design Interview Questions for Programmers, Software Engineers

Testing the design skill of a candidate is quite common on programming job interviews. Questions like, how do you design a vending machine or a traffic control system is very popular in object-oriented programming language interviews e.g. Java and C++. Designing a software System requires good experience and knowledge of tools of object-oriented design and analysis. You should not only be good at OOP fundamentals like Abstraction, Inheritance, Polymorphism, Encapsulation, Coupling, Cohesion, Association, Aggregation, or Composition but also on several important object-oriented design principles like SOLID Principles of Object Oriented Design. A good knowledge of when to use a class over an interface is also important for designing a maintainable software or Java application. Now, questions are how do you develop such skills? You need to practice and practice hard. This is why I am sharing some frequently asked object oriented design questions from Java programming interviews here.

Anyway, Software design has many facets, object-oriented system design is just one of them. Sometimes, you may be asked to design a database for an e-commerce application. Database design is totally different than object oriented design. There you need to follow rules of flexible and maintainable designs e.g. normalization. You need to make sure your tables are in 3rd normal form and there is a nice balance between duplication of data and easiness of querying the data.

Btw, this tutorial is about object oriented system design and I'll share questions on that. I'll write about SQL and database design sometime later to give you more information and some practice questions as well.

5 Object Oriented and Software Design Interview Questions

Here are my list of frequently asked object-oriented and software design questions from programming job interviews. You will find such kind of questions not only on biggies like Amazon, Google, Microsoft, and Facebook but also small startups and service based companies like Infosys, Wipro, TCS, and Cognizant.

Though for a comprehensive preparation I also suggest you take a look at Java Programming Interview Exposed, which contains questions from all important Java topics e.g. core java, data structure and algorithms, multithreading, garbage collection, JVM internals, and frameworks like Spring and Hibernate.

Problem 1: Design a Vending Machine in Java (solution)
You need to design a Vending Machine which follows following requirements
Accepts coins of 1,5,10,25, 50 Cents i.e. penny, nickel, dime, and quarter as well as 1 and 2 dollar note
Allow user to select products e.g. CANDY(10), SNACK(50), NUTS(90), Coke(25), Pepsi(35), Soda(45)
Allow user to take refund by canceling the request.
Return selected product and remaining change if any
Allow reset operation for vending machine supplier

Problem 2: Design a URL shortener service like (solution)
You need to design a URL shortener service like or You can insert full URL and get a short one. Your short URL should also record the stats about how many time it was accessed. Your system should also be able to handle concurrent user and millions of URL shortening per day. Think about auditing and bookkeeping as well. Btw, If you struggle to start with this questions then you can also see the Cracking the Coding Interview book, which contains a whole chapter on Object Oriented design and how to approach such problems.

Problem 3: Design a Lift system in your programming language. (solution)
An elevator is a combination of at least two elevator, one going up and other coming down. The goal is to minimize the waiting time of the user. Make sure you how your design will evolve if a lift is installed on high rise buildings over 20 floors. How many lift you need to server 40 floors with waiting time no less than 30 seconds on average. Think about parking strategy of your lift i.e which floor they should be resting or should they be keep going up or down etc.

Problem 4: Desing and implement LRU cache in Java or C++?
An LRU cache stands for Least Recently used. It should remove the least recently used item from cache to make space for a new item. Think about persistence strategy of cache. how do you build cache after crash etc

Problem 5: Design a Traffic Controller System for a Junction?
You need to design a software to control traffic lights at a junction where traffic are coming from four sides. It should follow basic traffic rules, allow a pedestrian to cross the road, and traffic to pass in reasonable time. How do you optimize the waiting time with respect to high traffic from one direction e.g. during morning and evening rush hours?

Top 5 Object Oriented Design Interview Questions for Programmers, Software Engineers

That's all in this list of frequently asked software design questions from programming job interviews. As I said, object-oriented analysis and design are one of the most sought after skill on job interviews. If you can demonstrate good design and coding skill, along with writing good JUnit test, it would create a very good impression on the interviewer. Everybody like good professional developers and unit testing is one of that thing which separate a professional to non-professional software engineers. If you have been asked any other object oriented design question or anything related to software design, feel free to share with us.

Other Programming Interview Questions for Java Programmers
  • 10 tricky Java Interview Questions for Experienced developers (list)
  • 21 frequently asked SQL Queries from Programming Interviews (list)
  • 18 Java design pattern interviews questions with answers (list)
  • 12 multi-threading and concurrency Interview Questions (list)
  • 40 Core Java Interview Questions from Phone Interviews  (list)
  • 21 Array Concept Interview Questions in Java? (list)
  • 22 Java Inheritance Interview Questions with answers (list)
  • 30 OOP Concept Interview Questions with Answers (list)

Further Learning
Design Pattern Library
From 0 to 1: Design Patterns - 24 That Matter - In Java
Java Design Patterns - The Complete Masterclass


  1. Great post.. can you post solutions as well ?

  2. I am unable to understand problem 4, can you give a brief solution of it?
    Thanks in advance.
    Kemar J.

  3. Replies
    1. Sorry, what do you mean? Are you not able to solve these problems or description not clear to you? The description has kept loose so that you don't have too many constraint to create solution.