Skip to content
Preptima

Low-Level Design & OOD interview questions and answers

Object-oriented design rounds where you produce classes, interfaces, and interactions rather than infrastructure boxes and arrows.

35 published across 7 topics.

OOP Principles

2 questions

Encapsulation, inheritance versus composition, polymorphism, and where each genuinely applies.

The five principles with realistic violations and refactorings, plus cohesion and coupling reasoning.

All 3 in SOLID & Design Heuristics

Factory, builder, singleton, and prototype, including when each is over-engineering.

mediumConceptCodingDesign

How would you implement a singleton, and why do many teams treat it as an anti-pattern?

The mechanics are easy - an enum in Java, a module-level value elsewhere - and are not the interesting part. The objection is that a singleton bundles two unrelated decisions, one instance and globally reachable, and the second is what makes dependencies invisible and tests order-dependent. It also connects creational patterns to the point an interviewer is testing.

4 minmid, senior
All 3 in Creational Patterns

Adapter, decorator, facade, proxy, and composite as answers to concrete design pressures.

mediumDesignCoding

A bundle can contain products or other bundles, and the pricing code should not care which it is holding. How would you model that?

A composite gives leaves and containers one interface so callers recurse without branching. The two decisions that matter are whether child management appears on that shared interface, and which operations genuinely aggregate - because price, availability and delivery date do not combine the same way. It also connects tree structures to the point an interviewer is testing.

6 minmid, senior, staff
All 3 in Structural Patterns

Strategy, observer, state, command, and template method in interview-sized problems.

mediumDesignCoding

Design the classes for a notification service that sends email, SMS and push. Which design patterns earn their place, and which would you leave out?

Name what varies first: channel, text, the user's channel choices and retry. A notification service then needs a channel interface (a strategy) picked from a registry, templates as data, a preference policy and a retry policy splitting transient from permanent errors. Most other design patterns add classes, not value.

6 minmid, senior
mediumConceptDesign

When would you use the observer pattern, and what goes wrong with it at scale?

Observer decouples a subject from things that react to it, which is right when the subject genuinely should not know its listeners. The costs are a control flow you cannot read from the code, listener lifetimes that leak, and an exception in one observer that silently prevents the rest from running.

4 minmid, senior, staff
All 4 in Behavioural Patterns

Thread-safe components, lock granularity, and immutable-object strategies.

All 6 in Concurrency in Design

Machine coding round questions such as parking lot, rate limiter, Splitwise, elevator, vending machine, and other timed build-it problems.

hardCodingDesign

Design an elevator system for a building with N lifts. When someone presses the call button, which lift answers, and where in your code is that decided?

An elevator system splits into a state machine per lift that decides its own next floor, and a dispatcher that assigns each hall call to one lift through a pluggable strategy such as a nearest-suitable-car cost. Car buttons go straight to their lift, and one control loop owns all state, so no god class and no locks.

6 minmid, senior
hardDesignCoding

Design a parking lot system — you have 90 minutes, working code at the end.

In a parking lot machine coding round, scope one deterministic flow of park, unpark and charge, model Vehicle, Slot, Level, Ticket and a ParkingLot facade, then push slot allocation and pricing behind strategy interfaces so review-time variants are configuration rather than surgery.

6 minmid, senior, staff
mediumCodingDesign

Design a rate limiter that allows N requests per client per minute. Write the class.

A rate limiter machine coding solution should reject fixed-window boundary bursts, usually with a token bucket. It needs no per-request history and stores two numbers per client, but only if refill is computed lazily from a timestamp rather than by running a background thread. Use this rate limiting answer to show the decision, trade-off, and evidence rather than a memorised definition.

4 minmid, senior
All 14 in Machine Coding Round