DSA Tracker

Low-level design

Low-level design interview questions

12 object-oriented design questions with an answer key each: what to confirm, which classes exist, how they connect, which pattern fits and where answers usually go wrong. Write your own class list first, then open the key.

The five steps every answer follows

  1. 1. Clarify. Ask what is in scope and write down four or five requirements before you name a class.
  2. 2. Name the entities. List the nouns in the requirements, then give each class exactly one job.
  3. 3. Connect them. Say who owns whom and who only refers to whom, and put whatever varies behind an interface.
  4. 4. Code the core. Write the main interfaces and one real method. Leave getters and setters out.
  5. 5. Stress it. Walk through the edge cases and one new requirement, and show that the change is a new class and not an edit.

Pick a question

Looking for servers and scale instead? System design practice

Questions

What is a low-level design (LLD) interview?
A low-level design round, also called an object-oriented design or machine coding round, asks you to turn a small product such as a parking lot or a cache into classes: which objects exist, what each one owns, how they talk to each other and where the design can change. It sits between a DSA round (one function) and a system design round (servers and databases). The answer is judged on clear responsibilities, sensible relationships and whether a new requirement becomes a new class or a rewrite.
How is low-level design different from system design?
System design, also called high-level design, is about machines: services, databases, caches, queues and how they scale. Low-level design is about the code inside one of those services: classes, interfaces, relationships and design patterns. A parking lot question has no load balancer in it, and a URL shortener question has no class diagram. Many interview loops ask one round of each, so practise both.
Which design patterns should I know for LLD interviews?
A small set covers most questions: Strategy (a rule that varies, such as pricing), State (behaviour that depends on a mode, such as a vending machine), Observer (tell others without knowing them), Factory (creation with real branching), Composite (trees such as a file system), Decorator (behaviour added around an object) and Command (actions you can undo). Name a pattern only when you can say what breaks without it. The 12 questions here show where each one fits and where it would only be decoration.
Do I have to write full code in an LLD round?
Usually not all of it. A discussion round wants the class list, the key interfaces and one or two core methods written properly, in the language you know best. A machine coding round gives more time and expects a program that runs. Either way, start with the requirements and the entities: code written before the model is agreed is the most common way to run out of time.