Object Oriented Design Interview Questions

I noticed that some of the companies (like Amazon) ask OOD questions during the interview. Usually, the question prompt sounds like “Design a Parking Lot System”. So, I have done some research on this topic and quite confused on what the expectations are?
From what I understand, candidate is supposed to write code. But it seems to me it is quite impossible to define and write down all the class and class Definitions, methods within the 40 min interview time. In addition, it seems that the expectations is also that candidate has to sketch something like a UML diagram.

What are your guys thoughts on this?

1 Like

Hi Adil! Great question!

I agree that OOD questions make it really hard to figure out what the interviewer is expecting from you since they are so open ended. I don’t really think there is one standard way that OOD interviews are done, since it really is dependent on the company and the interviewer. But I do think there are definitely steps you can take to make the process easier for yourself.

Most of this is from my own experience and what I’ve seen before.

  1. Ask a lot of questions
    This is probably the most effective and important part to figuring out what your interviewer’s expectations are. Like any technical question, you always want to clarify your input and output. It works the same way with OOD problems. Your questions for the interviewer should be direct and not vague. The more general your questions are the more general of an answer you’ll get. Some good initial questions to ask:
  • Do I have any constraints?
  • What objects can I assume I am given (ie. Car, User, etc.)? And what attributes do they have?
  • What is the goal or specific feature I am designing for?
  • What should my output look like?
  • Do I have any helper functions available?
  1. The next thing to keep in mind is that not every interviewer expects you to write out the code for every piece of logic. Also, UML diagrams can be helpful but are not always required. Once again, the most important thing is to ask questions. This is not a Leetcode problem, it’s a discussion.
  • Would you like me to write the Class definition?
  • Would you like me to write the code for this, or can I use pseudocode?
  • Can I assume that I have Helper Function A that does this for me already (possibly mention circling back to it if it’s not a core piece of logic)?
  • Would you like me to draw out the relationships between the objects?
  1. Most OOD interviews will be 45min to an hour long, which should be enough time for you to discuss your answer and write any code or diagrams that are needed. Very rarely will you ever get a super complicated OOD question that would require you to spend a majority of your time writing out code. They aren’t asking you to write a whole app and then run it. They are testing you on your design thinking, problem solving, code quality, and ability to communicate.

Hopefully this helps! I’m sure other people might have other opinions and experiences as well.

In my opinion it seems like they want you to ask lots of questions and explain your thought process, then maybe write some code. Questions that could be asked: Are there different types of parking spaces like: compact, electric vehicle charging only, handicap spaces, etc. Different types of vehicles? Is there a toll to enter the parking lot, which depends on time spent parked? How big is the parking lot? Is it possible to design an algorithm to park a car in the most optimal spot depending on all these factors. It all depends on what the interviewer wants, so I’d start off by asking lots of clarifying questions, and then go from there.