Interview Mastery: Junior to Senior Backend Engineering Questions
Master 75 categorized interview questions spanning Beginner, Intermediate, Advanced, and Senior Backend engineering with deep production rationales.
In technical interviews for Senior and Lead engineering positions, interviewers rarely ask for textbook definitions. They look for evidence of production battle scars: do you understand why systems fail under load, how latency cascades, and how to protect business state?
This lesson compiles 75 categorized questions designed to take you from foundational fundamentals to senior production excellence.
01Category 1: Beginner Fundamentals (Questions 01 - 20)
Q01: What is a Microservices Architecture, and how does it differ from a Monolith?
Answer: In a monolithic architecture, all business features (billing, catalog, authentication, shipping) reside in a single codebase, compile into a single artifact (JAR/WAR), and deploy onto a shared runtime sharing a single database. In a microservices architecture, the application is decomposed into small, independently deployable services organized around business domains. Each microservice owns its private database and communicates over lightweight protocols (HTTP/REST or gRPC).
Q02: What are the primary trade-offs of adopting Microservices?
Answer:
- Benefits: Independent deployments, autonomous team ownership, technology heterogeneity (polyglot stacks), fault isolation, and independent horizontal scaling.
- Costs: Distributed data complexity (no ACID joins), network latency, operational overhead (monitoring 50+ services), partial failure cascades, and complex deployment pipelines.
Q03: What is the "Database per Service" pattern, and why is it mandatory?
Answer: Each microservice must own its private database schema; no other service may directly query or modify that database via SQL. Communication must occur exclusively through published APIs or events. This guarantees loose coupling: team A can alter their internal schema without breaking team B.
Q04: Why is a shared database considered a major microservice anti-pattern?
Answer: A shared database creates tight coupling at the data layer. A schema change by one team can break multiple other services. It creates a single point of failure (SPOF) and causes database connection pool exhaustion when multiple services compete for database locks.
Q05: What is Conway's Law, and how does it influence microservices?
Answer: "Organizations which design systems are constrained to produce designs which are copies of the communication structures of these organizations." (Melvin Conway). Microservices align code architecture with small, autonomous two-pizza teams responsible for a single business capability from inception to production.
Q06: What is a Bounded Context in Domain-Driven Design (DDD)?
Answer: A bounded context is an explicit boundary within which a specific domain model applies. Inside that boundary, all terms in the Ubiquitous Language have a single unambiguous meaning. For example, a User in the Identity Bounded Context has password hashes and MFA tokens, while a Customer in the Shipping Bounded Context has delivery addresses and customs preferences.
Q07: What is Ubiquitous Language?
Answer: A common, rigorous language shared by software developers and business domain experts. Terms in code (classes, variables, API routes) must match the exact business terminology (e.g. OrderPlaced, AccountDebited, ParcelDispatched), eliminating translation friction.
Q08: What is the difference between Synchronous and Asynchronous communication?
Answer:
- Synchronous: The caller sends a request (e.g. HTTP GET/POST) and blocks waiting for the recipient to respond before proceeding. High coupling; vulnerable to cascading latency.
- Asynchronous: The caller sends a message or emits an event (e.g. via an outbox table or message broker) and immediately resumes work without waiting for processing completion. Decoupled and resilient to receiver outages.
Q09: What is Spring Cloud Netflix Eureka?
Answer: A service registry where microservice instances register their network location (IP address and port) upon startup and send periodic heartbeats (every 30 seconds). Other services query Eureka to dynamically discover healthy instances without hardcoding IP addresses.
Q10: What is Spring Cloud Gateway?
Answer: An intelligent, non-blocking reverse proxy built on Spring 5, Project Reactor, and Netty. It acts as the single entry point for all client traffic, handling route matching, security token relay, rate limiting, and request modification before forwarding traffic downstream.
Q11: What is OpenFeign?
Answer: A declarative REST client developed by Netflix and maintained by the Spring Cloud community. Instead of writing boilerplate HTTP code, you declare a Java interface with Spring MVC annotations (@GetMapping, @PostMapping), and Feign generates the dynamic HTTP proxy implementation at runtime.
Q12: Why should DTOs (Data Transfer Objects) be kept separate from Database Entities?
Answer: Entities represent internal database table schemas with JPA lifecycle states, lazy-loading proxies, and foreign key relations. Exposing entities directly over REST leaks database structures, exposes sensitive columns (e.g. password hashes), and triggers LazyInitializationException during JSON serialization. DTOs form an explicit, versioned API contract.
Q13: What is Spring Boot Actuator?
Answer: A sub-project of Spring Boot that provides production-ready monitoring and management endpoints (/actuator/health, /actuator/metrics, /actuator/env, /actuator/prometheus) allowing orchestrators like Kubernetes to check liveness and readiness states.
Q14: What is the difference between Kubernetes Liveness and Readiness probes?
Answer:
- Liveness Probe: Checks if the container process is alive. If it fails (e.g. JVM deadlock or OOM crash), Kubernetes restarts the container.
- Readiness Probe: Checks if the container is ready to accept incoming traffic (e.g. database connection established, caches warmed). If it fails, Kubernetes stops routing ingress traffic to that pod without killing it.
Q15: What is API Versioning, and what are the standard strategies?
Answer: The practice of managing changes to an API contract so existing clients do not break. Common strategies include:
- URI Path:
/api/v1/orders(most common and transparent). - Request Header:
X-API-Version: 2. - Accept Header (Content Negotiation):
Accept: application/vnd.veltoryx.v2+json.
Q16: What is an Idempotent HTTP method?
Answer: An HTTP method is idempotent if making multiple identical requests has the exact same side-effect on server state as making a single request. GET, PUT, and DELETE are idempotent by HTTP specification; POST is non-idempotent.
Q17: What is Spring Cloud Config Server?
Answer: A centralized externalized configuration management service that stores configuration properties (application.yml) in a centralized Git repository or Vault. Services load their environment-specific properties at startup and can refresh properties dynamically via Spring Cloud Bus.
Q18: What is a Correlation ID (Trace ID)?
Answer: A unique alphanumeric identifier generated at the API Gateway for an incoming request and propagated via HTTP headers (such as X-Correlation-Id or W3C traceparent) across every downstream microservice, enabling engineers to filter millions of log records and view only the logs for that specific transaction.
Q19: What is Distributed Tracing?
Answer: A diagnostic methodology that tracks the path of a request through a distributed network of microservices. It breaks a request into a root Trace composed of multiple Spans (representing individual service hops or database queries), visualizing latency bottlenecks in tools like Jaeger or Zipkin.
Q20: What is the Three Pillars of Observability?
Answer:
- Metrics: Aggregable numerical measurements over time (e.g. CPU utilization, request rate, P99 latency).
- Logs: Timestamped, structured discrete event records (e.g. "Order 101 payment failed: timeout").
- Traces: End-to-end request journeys across distributed network boundaries.
Loading the rest of the lesson…