📥 Download Complete 2026 Printable PDF Notes, Architecture Diagrams & GitHub Code
Get instant free access to the 2026 printable PDF cheat-sheet, runnable lab repositories, interview evaluation rubric, and AI Campus 6-Month Paid Corporate Internship roadmap.
Download Free PDF & Syllabus Roadmap →Top 12 Senior Low-Level Design (LLD), Object-Oriented Design & Design Patterns Questions (2026)
Production Low-Level Design (LLD), SOLID refactorings, design patterns, concurrency controls, and machine coding problems asked during SDE-2 and SDE-3 technical interview rounds:
Q1 Explain SOLID Principles with production code violations and refactored patterns.
OrderService that validates cart, charges credit card, and writes PDF invoices. Refactor: Separate into PaymentProcessor, InvoiceGenerator, and OrderRepository. O - Open/Closed Principle (OCP): Software entities should be open for extension, but closed for modification. Achieved via interfaces and Strategy/Factory patterns instead of chaining if-else or switch blocks on type codes. L - Liskov Substitution Principle (LSP): Subtypes must be substitutable for their base types without altering correctness (e.g. Square inheriting Rectangle violates LSP because setting width changes height). I - Interface Segregation Principle (ISP): Clients should not be forced to depend on methods they do not use; prefer fine-grained interfaces. D - Dependency Inversion Principle (DIP): High-level modules should depend on abstractions (interfaces), not low-level concrete implementations.
Q2 Compare Factory Method vs Abstract Factory Pattern with real-world examples.
NotificationFactory.createNotification('SMS') returns an SMSNotification). Abstract Factory: Provides an interface for creating families of related or dependent objects without specifying their concrete classes. Example: A cross-platform UI toolkit with GUIFactory producing matching families of widgets: MacButton + MacCheckbox vs WindowsButton + WindowsCheckbox, guaranteeing consistent themes across client platforms.
Q3 How does the Strategy Pattern enable dynamic algorithm switching (e.g. Payment Gateways / Routing)?
interface PaymentStrategy { void pay(int amount); }
class RazorpayStrategy implements PaymentStrategy { ... }
class StripeStrategy implements PaymentStrategy { ... }
class UpiStrategy implements PaymentStrategy { ... }
class CheckoutService {
private PaymentStrategy strategy;
public void setPaymentStrategy(PaymentStrategy strategy) { this.strategy = strategy; }
public void processOrder(int total) { strategy.pay(total); }
} This completely satisfies Open/Closed Principle.
Q4 Explain the Observer Pattern and how it forms the foundation for Event-Driven Architectures.
UserRegisteredEvent) from auxiliary services (e.g., WelcomeEmailHandler, SlackAlertHandler, AnalyticsTrackingHandler) which attach dynamically without modifying the registration service.
Q5 How do you implement a thread-safe Singleton in Java/C++ (Double-Checked Locking vs Enum Singleton)?
public class DatabaseConnection {
private static volatile DatabaseConnection instance;
private DatabaseConnection() {}
public static DatabaseConnection getInstance() {
if (instance == null) {
synchronized (DatabaseConnection.class) {
if (instance == null) {
instance = new DatabaseConnection();
}
}
}
return instance;
}
} In modern Java, the Enum Singleton (public enum DatabaseConnection { INSTANCE; }) is the gold standard because JVM guarantees single instantiation, thread safety, and built-in serialization safety against reflection attacks.
Q6 What is the Decorator Pattern and how is it used in enterprise middleware and logging?
new BufferedReader(new FileReader('file.txt')), Python function decorators (@timed, @authenticated), and HTTP web frameworks where middleware wraps request handlers with authentication, distributed tracing (OpenTelemetry span injection), and rate-limiting wrappers.
Q7 Design the Low-Level Architecture for an Enterprise Parking Lot System.
ParkingLot (singleton holding floors), ParkingFloor, ParkingSpot (subclasses: Compact, Large, EV, Handicapped), Vehicle (Car, Truck, Motorcycle, EVCar), Ticket, and PaymentPortal. Key design patterns used: 1) Strategy Pattern for spot assignment: FarthestSpotStrategy, NearestSpotToEntranceStrategy, 2) Factory Pattern for vehicle spot allocation, and 3) Observer Pattern: Display boards update available spots per floor automatically when sensors detect vehicle entry/exit.
Q8 Design an Elevator Control System with multi-car dispatching (SCAN / LOOK algorithm).
ElevatorCar (state: IDLE, UP, DOWN; currentFloor, doorStatus), InternalPanel, ExternalPanel, ElevatorController, and DispatchStrategy. Use the LOOK / SCAN Algorithm (similar to disk head scheduling): the elevator car continues traveling in the current direction as long as there are pending requests ahead in that direction, servicing stops sequentially before reversing direction, preventing passenger starvation. A centralized Dispatcher assigns incoming hall calls to the car with minimum estimated arrival time (ETA).
Q9 Explain Concurrency Control: Mutexes vs Read-Write Locks vs Optimistic Concurrency Control (OCC).
version number. On commit, if the version changed, the transaction aborts and retries. Standard pattern for distributed databases and microservice REST APIs (using HTTP ETag / If-Match headers).
Q10 Compare Dependency Injection (DI) vs Service Locator: Why is Spring / NestJS DI preferred?
Locator.get(PaymentService.class)). Drawbacks: It hides class dependencies inside implementation code, breaks modularity, and complicates unit testing because mock injection requires configuring the static locator. Dependency Injection (DI): Inversion of Control where dependencies are passed directly into constructors (Constructor Injection). Makes dependencies explicit, enables clean unit testing with mock frameworks (Mockito, Jest), and promotes loose coupling.
Q11 Explain the Builder Pattern: How does it eliminate telescoping constructors and enforce invariants?
User.builder().name('Alice').email('...').age(28).build()). The build() method executes comprehensive cross-field validation rules and invariant checks before returning an immutable instance.
Q12 What is the State Pattern and how does it clean up complex workflow status transitions?
switch(orderStatus) blocks inside every method, each state is modeled as an independent class implementing an interface (e.g. OrderState: cancel(), ship(), refund()). In PlacedState, calling ship() transitions to ShippedState; in DeliveredState, calling ship() throws an IllegalStateException. Cleanly prevents invalid state transitions.
Q1 What is the difference between Monolithic, Microservices, and Event-Driven Architectures?
Monoliths combine all business modules in a single codebase and database; easy to develop initially, but difficult to scale independently.
Microservices partition domains into autonomous services communicating over REST/gRPC with private databases.
Event-Driven Architectures decouple services via message brokers (Kafka/RabbitMQ) producing and consuming asynchronous events.
Q2 Explain Database Concurrency Control: Optimistic vs Pessimistic Locking.
Optimistic Locking checks a version column at commit time; fails if another transaction updated the row concurrently (ideal for low contention).
Pessimistic Locking locks rows using `SELECT ... FOR UPDATE` preventing other transactions from modifying data until commit (ideal for high contention).
Q3 How do you design an idempotent REST API?
An API is idempotent when making multiple identical requests has the exact same side-effect as a single request. GET, PUT, DELETE are idempotent by HTTP spec.
For POST endpoints, require a client-generated Idempotency-Key header stored in Redis with cached responses.
Q4 What are Circuit Breakers in distributed microservices (Netflix Hystrix / Resilience4j)?
Circuit Breakers monitor remote service failure rates. When failures exceed a threshold, the breaker 'trips' (OPEN state), immediately returning fallbacks without waiting for slow timeouts, protecting the system from cascading failure.
Q5 Explain Garbage Collection in JVM or V8 and how memory leaks occur in managed runtimes.
Runtimes use generational mark-and-sweep garbage collection. Memory leaks occur when unused objects remain reachable from GC Roots (e.g. unclosed event listeners, static collections, lingering timers).
Q6 What is the difference between Process vs Thread vs Coroutine/Goroutine?
A Process has its own virtual memory space. Threads share process memory and are scheduled by the OS kernel.
Coroutines/Goroutines are user-space green threads cooperatively scheduled by language runtimes, using only ~2-4 KB stack memory.
Q7 How do you handle API Versioning in enterprise systems?
Common strategies: URI path versioning (/v1/users), Query parameter versioning (/users?version=1), and Header/Accept header content negotiation.
Q8 Explain WebSockets vs Server-Sent Events (SSE) vs Long Polling.
WebSockets provide full-duplex bidirectional TCP communication for interactive chats/gaming.
Server-Sent Events (SSE) provide unidirectional text streaming over HTTP/2, ideal for LLM token streaming.
Long polling holds HTTP connections open until data arrives; high overhead.
Q9 What is the difference between Horizontal Scaling and Vertical Scaling?
Vertical Scaling adds more CPU/RAM to a single server; simple but hits hardware limits.
Horizontal Scaling adds more commodity servers behind load balancers; offers virtually unlimited scalability and high availability.
Q10 How do you implement Distributed Tracing with OpenTelemetry and Jaeger?
OpenTelemetry propagates a unique Trace ID and Span ID across HTTP/gRPC headers (W3C Trace Context: `traceparent`). Jaeger visualizes the end-to-end request timeline across all microservices.
Accelerate Your Career with Guaranteed Paid Internship*
Transparent ₹1,20,000 Fee (Inclusive of GST) • ₹10,000/month No-Cost EMI • 6-Month Corporate Paid Internship (₹15,000 – ₹35,000/mo stipend) with official IBM & Microsoft Credly credentials.
