Backend Developer Interview Questions and Answers

Backend developer interview questions with answers: HTTP and REST, API design, databases, caching, queues, concurrency, security, scalability and practical design scenarios.

Updated November 20, 2026 31 questions 7 min read

Key takeaways

  • Backend interviews test APIs, databases and how systems behave under load and failure.
  • Expect questions on HTTP semantics, idempotency, transactions, indexes and caching.
  • Mid-level and senior candidates get design scenarios: rate limiters, queues, consistency trade-offs.
  • Security basics (authentication, authorization, injection, secrets) come up in almost every loop.
Contents

Backend interviews test whether you can build correct, secure and scalable services: API design, databases, caching, messaging and how systems behave when things fail. Below are 31 common questions grouped by topic and level.

What backend interviews cover

Typical topic mix in a backend interview loop

Editorial estimate; senior loops add a full system design round.

4–5rounds
  • Coding25%
  • APIs and HTTP15%
  • Databases20%
  • Caching, queues and concurrency15%
  • System design15%
  • Security10%

Resilience patterns at a glance

ProblemPattern
Duplicate requests after retriesIdempotency keys
Slow or failing dependencyTimeouts, retries with backoff, circuit breaker
Traffic spikesQueues, autoscaling, rate limiting, load shedding
Data change + event publishOutbox pattern
Multi-service workflowSaga with compensating actions
Hot readsCache-aside with TTL and stampede protection

Continue with system design questions and our system design interview guide.

HTTP and APIs

1What are the main HTTP methods, and which are idempotent?

Junior

GET reads, POST creates or triggers actions, PUT replaces, PATCH partially updates, DELETE removes. GET, PUT and DELETE are idempotent (repeating them has the same effect as once); POST and PATCH generally are not. GET should also be safe, meaning without side effects.

2What makes an API RESTful?

Junior

Resources identified by URLs (/orders/42), standard methods and status codes, stateless requests, and representations such as JSON. Good REST APIs use nouns for resources, consistent naming, pagination for lists and clear error responses.

3How do you make a POST request safe to retry?

Mid

Use an idempotency key: the client sends a unique key with the request, the server stores the key with the result and returns the same result for repeated requests. This prevents double charges when a client retries after a timeout.

4REST vs GraphQL vs gRPC?

Mid

REST: simple, cacheable, widely understood. GraphQL: clients request exactly the fields they need from one endpoint, good for complex frontends, but caching and rate limiting are harder. gRPC: binary protocol over HTTP/2 with strict contracts and streaming, good for service-to-service communication.

5How do you paginate a large list?

Mid

Offset pagination (?limit=50&offset=1000) is simple but slow for deep pages and unstable when data changes. Cursor (keyset) pagination uses the last seen key (?after=2026-11-20T10:00:00Z_123) and an index, which stays fast and consistent.

6How do you version an API?

Mid

Avoid breaking changes where possible: add fields, don’t remove or rename them. When a breaking change is necessary, version through the URL (/v2/) or a header, run both versions for a deprecation period, and communicate the timeline to clients.

Databases

7SQL vs NoSQL: how do you choose?

Junior

Relational databases give strong consistency, joins and transactions, and fit most business data. NoSQL stores (document, key-value, wide-column) trade some of that for flexible schemas or horizontal scale for specific access patterns. Start relational unless you have a clear reason not to.

8What is an index, and when can it hurt?

Mid

A data structure (usually a B-tree) that speeds up lookups and sorting on the indexed columns. Indexes cost storage and slow down writes, and unused or duplicate indexes are pure overhead. Index columns used in frequent filters and joins, and check query plans.

9What is the N+1 query problem?

Mid

Loading a list with one query and then one more query per item to load related data. Fix it with joins, batched IN (...) queries, or eager loading in the ORM. It is one of the most common causes of slow endpoints.

10Optimistic vs pessimistic locking?

Mid

Pessimistic: lock the row while working on it (SELECT ... FOR UPDATE), simple but reduces concurrency. Optimistic: read a version number, and update only if it hasn’t changed (UPDATE ... WHERE id = ? AND version = ?); retry on conflict. Optimistic works well when conflicts are rare.

11How do you scale a database?

Senior

In order: optimize queries and indexes, add caching, use read replicas for read-heavy traffic, scale vertically, partition large tables, and finally shard across databases by a key, which complicates queries and transactions. Connection pooling matters at every stage.

12How do you run a schema migration on a large table without downtime?

Senior

Use the expand-and-contract pattern: add new columns or tables in a backward-compatible way, deploy code that writes to both, backfill in batches, switch reads, then remove the old structure in a later release. Avoid long locks; many databases support adding columns or indexes concurrently.

Get Backend answer points in real time during your interview

Sottena listens to the interviewer, detects each question and shows short answer points in about a second. 150 free credits, no card required.

Caching and messaging

13Explain cache-aside and its pitfalls.

Mid

The app reads from the cache, and on a miss reads from the database and stores the result with a TTL. On updates, it invalidates the key. Pitfalls: stale data, cache stampedes when a popular key expires (use locking or early refresh), and inconsistency between cache and database.

14When would you use a message queue?

Mid

To decouple services, smooth traffic spikes, and run slow work asynchronously (emails, video processing, webhooks). Queues and logs like RabbitMQ, SQS or Kafka also allow retries and multiple consumers.

15What delivery guarantees do message systems offer?

Mid

At-most-once (may lose messages), at-least-once (may duplicate), and effectively exactly-once, which usually means at-least-once delivery plus idempotent consumers. Design consumers to handle duplicates, for example with a processed-message table.

16What is the outbox pattern?

Senior

To update the database and publish an event reliably, write the event to an outbox table in the same transaction as the data change. A separate process reads the outbox and publishes events, retrying until it succeeds. This avoids losing events or publishing events for rolled-back changes.

Concurrency and performance

17Processes vs threads vs async I/O?

Mid

Processes have isolated memory; threads share memory and need synchronization; async I/O handles many waiting connections on few threads. Most backend work is I/O-bound, so async runtimes or lightweight threads (goroutines, virtual threads) scale well.

18What is a race condition? Give a backend example.

Mid

When the result depends on the timing of concurrent operations. Example: two requests read a balance of 100 and each subtract 80, leaving 20 instead of rejecting one. Fix it with a transaction and row lock, an atomic update (UPDATE ... SET balance = balance - 80 WHERE balance >= 80), or optimistic locking.

19An endpoint got slow. How do you investigate?

Mid

Check when it started and what changed, look at latency percentiles and traces to see where time goes, inspect slow queries and their plans, check external calls, connection pools and resource saturation, then fix the bottleneck and add monitoring for it.

20How do you make a service resilient to failing dependencies?

Senior

Timeouts on every call, retries with exponential backoff and jitter (only for idempotent operations), circuit breakers to stop hammering a failing service, bulkheads to isolate resources, fallbacks or degraded responses, and load shedding when overloaded.

Security

21Authentication vs authorization?

Junior

Authentication verifies who you are (login, tokens). Authorization decides what you’re allowed to do (roles, permissions, ownership checks). Many vulnerabilities come from missing authorization checks, such as reading another user’s order by changing its ID.

22Sessions vs JWT?

Mid

Server-side sessions store state on the server and send an opaque cookie; they’re easy to revoke. JWTs are signed tokens containing claims, verified without a lookup, but hard to revoke before expiry. Use short-lived access tokens with refresh tokens, and store them in HttpOnly, Secure cookies on the web.

23How do you prevent SQL injection?

Junior

Use parameterized queries or prepared statements, never string concatenation:

cur.execute("SELECT * FROM users WHERE email = %s", (email,))

Add input validation and least-privilege database accounts as extra layers.

24How should you store passwords?

Mid

Hash them with a slow, salted algorithm designed for passwords: Argon2id, bcrypt or scrypt. Never store plain text or use fast hashes like SHA-256 alone. Add rate limiting and optional multi-factor authentication.

Architecture

25Monolith vs microservices?

Mid

A monolith is simpler to develop, test and deploy, and is the right start for most teams. Microservices allow independent deployment and scaling but add network calls, distributed data, observability and operational complexity. Split when team size or scaling needs justify it.

26Explain the CAP theorem in practical terms.

Senior

During a network partition, a distributed system must choose between consistency (all nodes agree) and availability (every request gets a response). In practice, systems choose per operation: payments need consistency, a social feed can tolerate eventual consistency.

27How do you handle a transaction across several services?

Senior

Avoid it if possible by redrawing service boundaries. Otherwise use a saga: a sequence of local transactions with compensating actions on failure, coordinated by events (choreography) or a coordinator (orchestration). Two-phase commit is rarely used across services because it hurts availability.

Practical scenarios

28Design a rate limiter for an API.

Mid

Choose an algorithm: token bucket (allows bursts) or sliding window. Store counters in Redis keyed by user or API key with atomic operations and expiry, return 429 Too Many Requests with a Retry-After header, and decide whether to fail open or closed if Redis is unavailable.

29How would you implement file uploads for large files?

Mid

Let clients upload directly to object storage with pre-signed URLs (and multipart upload for very large files), so traffic doesn’t go through your servers. Store metadata in the database, process files asynchronously (virus scan, thumbnails), and validate type and size.

30How do you send a webhook reliably?

Senior

Store the event, deliver it from a background worker with timeouts, retry with exponential backoff, sign the payload (HMAC) so receivers can verify it, include an event ID for deduplication, and provide a way to replay failed deliveries.

31What do you log, and what don’t you log?

Mid

Log structured events with a request ID, important state changes, errors with context and latency of external calls. Never log passwords, tokens, full card numbers or other sensitive personal data. Keep log levels meaningful to avoid noise.

How to prepare

  1. Know HTTP and databases deeplyMethods, status codes, idempotency, transactions, isolation, indexes.
  2. Practice design scenariosRate limiter, URL shortener, file uploads, webhooks, notification system.
  3. Prepare a performance storyA slow endpoint or incident you fixed, with numbers.
  4. Review security basicsAuth, authorization checks, injection, password storage, secrets.
  5. Be fluent in one stackExpect follow-ups in your main language and framework.

Get answer points in real time during your interview

Sottena listens to the interviewer, detects each question and shows short answer points in about a second. 150 free credits, no card required.

Related interview questions