Design Patterns & LLD
Gang of Four creational, structural, and behavioral patterns; SOLID principles applied to real code; microservice-level patterns; and the machine-coding problems (Parking Lot, Elevator, Rate Limiter) that low-level design rounds actually ask.
Creational Patterns (Java)
What is the Singleton pattern? Implement it using double-checked locking.
beginnerProTests whether you can write a correctly synchronized Singleton, not just describe the pattern conceptually.
Singleton — Eager vs Lazy vs Double-checked locking vs Enum Singleton — compare all four approaches.
intermediateProTests whether you know the tradeoffs in initialization timing, thread safety, and serialization safety across all four variants.
What is the difference between constructor overloading and constructor chaining?
intermediateProTests whether you know one is about multiple constructor signatures and the other is about constructors calling each other via this().
Can Singleton be broken? Name 4 ways (Reflection, Serialization, Cloning, Multithreading).
beginnerProTests whether you know Singleton isn't actually bulletproof, and how to defend against each specific attack.
What is the Factory Method pattern? How does it differ from Simple Factory?
beginnerProTests whether you know Factory Method delegates creation to subclasses, unlike a single static factory method.
What is the Abstract Factory pattern? Give a real-world Java example.
intermediateProTests whether you know how to produce families of related objects without specifying their concrete classes.
What is the Builder pattern? When should you use it over a constructor?
beginnerProTests whether you know when a fluent step-by-step builder is more readable than a constructor with many optional parameters.
Behavioral Patterns (Java)
Strategy pattern vs State pattern — both swap behavior at runtime, so what actually distinguishes them?
intermediateProTests whether you know Strategy is chosen externally by the client, while State transitions are driven internally by the object itself.
Where is the Observer pattern used in real-world Spring applications?
intermediateProTests whether you can connect the abstract pattern to Spring's own ApplicationEvent/ApplicationListener mechanism.
What is the Strategy pattern? Show an example (sorting strategies).
beginnerProTests whether you know how to swap an algorithm's implementation at runtime without changing the calling code.
What is the Observer pattern? How does Java's EventListener relate to it?
beginnerProTests whether you know the publish-subscribe relationship behind one of Java's oldest built-in event models.
What is the Template Method pattern? Where is it used in Spring (JdbcTemplate)?
intermediateProTests whether you know how a base class fixes the algorithm's skeleton while letting subclasses fill in specific steps.
What is the Chain of Responsibility pattern? How does it differ from Command?
intermediateProTests whether you know Chain of Responsibility passes a request along handlers while Command encapsulates a request as an object.
Structural Patterns (Java)
Proxy pattern vs Decorator pattern — both wrap an object, so what's the real difference in intent?
intermediateProTests whether you know Proxy controls access to the same interface while Decorator adds new behavior on top of it.
What is the Adapter pattern? Explain with a Java example.
beginnerProTests whether you know how to make two incompatible interfaces work together without modifying either one.
What is the Decorator pattern? How is it used in java.io?
beginnerProTests whether you can connect the pattern to something you've already used, like wrapping InputStream with BufferedInputStream.
What is the Proxy pattern? Explain the 3 types: Virtual, Remote, and Protection proxy.
intermediateProTests whether you know the different reasons to interpose a proxy — lazy loading, network calls, or access control.
What is the Flyweight pattern? How does it save memory?
intermediateProTests whether you know how sharing common object state across many instances reduces memory footprint.
OOP Fundamentals for LLD
Composition vs Inheritance — when should you prefer one over the other?
intermediateProTests whether you know 'favor composition over inheritance' isn't a blanket rule but depends on whether an IS-A relationship genuinely holds.
What is the difference between aggregation and composition?
intermediateProTests whether you know composition implies ownership and lifecycle dependency, while aggregation is a looser has-a relationship.
What is the Law of Demeter (Principle of Least Knowledge)?
intermediateProTests whether you know why chaining calls through multiple objects (a.getB().getC().doSomething()) is a design smell.
What is immutability, and how do you design a genuinely immutable class in Java?
intermediateProTests whether you know all the rules — final fields, no setters, defensive copying of mutable fields — not just marking a class final.
What is the difference between IS-A and HAS-A relationships? Give design examples.
beginnerProTests whether you know when inheritance is appropriate versus when composition is the better design choice.
What is cohesion and coupling? How do you achieve high cohesion and loose coupling?
intermediateProTests whether you understand the two core forces that determine how maintainable an object-oriented design actually is.
UML & Schema Design
How do you model class inheritance in a relational database?
intermediateProTests whether you know the three standard strategies (single table, joined, table-per-class) and their tradeoffs.
How do you translate a UML class diagram into a database schema?
intermediateProTests whether you know the mapping rules for associations, multiplicities, and inheritance from object model to relational tables.
What is a sequence diagram? Draw one for a user logging into an application.
intermediateProTests whether you can visually communicate the order of interactions between objects during a login flow.
Machine Coding Problems
Design a Chess Game — pieces, moves, turn management, check/checkmate detection.
advancedProTests whether you can model a rich rule system with polymorphic piece behavior cleanly in objects.
Design a task management system like Trello — boards, lists, cards, drag-and-drop ordering.
intermediateProTests whether you can model a nested hierarchy with ordering that needs to stay consistent as items move around.
Design a Logger Framework — log levels, multiple appenders (console, file, remote).
intermediateProTests whether you know how to design a pluggable appender architecture that's easy to extend without modifying existing code.
Design a text editor with undo/redo support.
advancedProTests whether you know the Command pattern is the natural fit for reversible, replayable operations.
Design a Circuit Breaker component from scratch — CLOSED, OPEN, HALF-OPEN state machine.
advancedProTests whether you can implement the actual state transitions and thresholds, not just describe the pattern.
Design a Restaurant Reservation System — tables, time slots, party size, conflict prevention.
advancedProTests whether you can handle overlapping-interval conflict checks and thread-safe booking cleanly.
Design the classic Snake Game — grid, movement, food, collision detection, growth.
intermediateProTests whether you can model game state and collision logic cleanly with simple data structures.
Design a Concurrent HashMap from scratch — how would you implement thread-safe bucket-level locking?
expertProTests whether you can reason about fine-grained locking design, not just use java.util.concurrent.ConcurrentHashMap as a black box.
Design a Parking Lot System — multi-floor, vehicle types, fee calculation.
beginnerProOne of the most common machine-coding rounds — tests whether you can model entities, allocate spots, and calculate fees cleanly.
Design a Vending Machine — product selection, payment, change, inventory.
beginnerProTests whether you can model a state machine (idle, selecting, paying, dispensing) cleanly in object-oriented code.
Design an Elevator System — single elevator, request queue, floor movement.
intermediateProTests whether you can design a request-scheduling algorithm and represent elevator state correctly.
Design a Movie Ticket Booking System (Bookmyshow) — seats, shows, booking.
intermediateProTests whether you can model seats, shows, and concurrent booking without double-allocating the same seat.
Design a Splitwise / Expense Sharing App.
advancedProTests whether you can model balances between multiple users and simplify debts efficiently.
Design an In-Memory Rate Limiter — Token Bucket, Sliding Window algorithms.
intermediateProTests whether you can implement at least one real rate-limiting algorithm correctly, not just name it.
Design a Payment Gateway — multiple providers, retry, refund, idempotency.
advancedProTests whether you can design around provider abstraction, safe retries, and idempotent payment processing.
SOLID Principles
What are the SOLID principles? Name all 5 with one-line definitions.
beginnerProTests whether you can rattle off SRP, OCP, LSP, ISP, and DIP cleanly under interview pressure.
Single Responsibility Principle — give a bad example and refactored good example.
beginnerProTests whether you can actually spot an SRP violation in code and refactor it, not just define the principle.
Microservice Patterns — Decomposition
What is the Decompose by Business Capability pattern?
beginnerProTests whether you know how to draw microservice boundaries around what the business does, not around technical layers.
What is the Backend for Frontend (BFF) pattern? When do you need separate gateways?
intermediateProTests whether you know why a mobile client and a web client often need different API shapes from the same backend.
Microservice Patterns — Data & Resilience
What is the Outbox Pattern (Transactional Outbox)? How does it guarantee message delivery?
advancedProTests whether you know how to atomically update a database and publish an event without a fragile dual-write.
What is the Idempotency pattern for APIs? How do you implement an idempotency key?
advancedProTests whether you know how to make a retried request safe to process more than once without double-charging or double-booking.
Microservice Patterns — Deployment
What is the Sidecar pattern? What responsibilities does a sidecar container handle? How does Ambassador differ from it?
intermediateProTests whether you know how a helper container extends a service's capabilities without changing the service's own code.
What is the Canary Deployment pattern? How does it reduce release risk?
intermediateProTests whether you know how routing a small percentage of real traffic to a new version limits the blast radius of a bad release.
SOLID Principles in LLD
OCP: How do you extend a PaymentProcessor to add UPI without modifying existing code?
intermediateProTests whether you can apply the Open/Closed Principle to a realistic scenario, not just quote its definition.
LSP: Give a classic violation example (Rectangle-Square problem) and how to fix it.
intermediateProTests whether you know the textbook example of a subtype that technically extends a class but breaks its behavioral contract.
Concurrency in LLD
What is a race condition in LLD? Give a real example from a booking system.
intermediateProTests whether you can connect the abstract concept of a race condition to a concrete double-booking bug.
How would you design a thread-safe LRU Cache?
advancedProTests whether you know how to add correct synchronization to an LRU cache without serializing every single access.