20 interview questions
Backend developer interview questions and answers
Backend interviews focus on how you design APIs, model and query data, and keep services correct and fast under load. Expect coding plus discussion of trade-offs: consistency versus availability, caching versus freshness, simplicity versus scale. The questions below cover what most backend loops ask.
Updated
APIs and HTTP
01How do you design a REST API for a new resource?
What they want to hear: Clean, predictable interface design and attention to the details that make APIs easy to use.
Answer outline
- Model resources as nouns: GET /orders, POST /orders, GET /orders/{id}, PATCH /orders/{id}.
- Use status codes correctly: 201 for created, 400 for bad input, 404 for not found, 409 for conflicts.
- Add pagination, filtering and consistent error bodies from the start.
- Plan for versioning and backwards-compatible changes.
02What does idempotent mean, and why does it matter?
What they want to hear: Whether you design for retries, which every real network causes.
Answer outline
- An operation is idempotent if doing it several times has the same effect as doing it once.
- GET, PUT and DELETE are idempotent by definition; POST usually is not.
- Clients and proxies retry on timeouts, so non-idempotent endpoints can create duplicate orders or payments.
- Use idempotency keys: the client sends a unique key, the server stores the result and returns it on repeats.
03REST, GraphQL or gRPC: how would you choose?
What they want to hear: Trade-off thinking instead of a favourite technology.
Answer outline
- REST: simple, cache friendly, widely understood; good default for public APIs.
- GraphQL: clients ask for exactly the fields they need; useful with many clients and nested data, but caching and query cost need care.
- gRPC: typed contracts and efficient binary transport; good for internal service-to-service calls.
- Choose by clients, team experience and performance needs.
04How would you implement authentication for an API?
What they want to hear: Security basics and awareness of the trade-offs between sessions and tokens.
Answer outline
- Never store plain passwords; hash them with a slow algorithm such as bcrypt or argon2.
- Sessions: a random id in an HttpOnly, Secure cookie, with state on the server; easy to revoke.
- Tokens such as JWT: signed and stateless, short-lived, with refresh tokens; revocation needs extra work.
- Separate authentication (who you are) from authorization (what you may do), and check permissions on every request.
Databases
05SQL or NoSQL: how do you choose a database?
What they want to hear: Choosing storage by access patterns and consistency needs, not trends.
Answer outline
- Relational databases fit structured data with relationships and transactions, and they are a strong default.
- Document stores fit flexible, self-contained records read by key.
- Key-value and wide-column stores fit very high write volume or simple lookups at scale.
- Start from the queries you need to run and the consistency guarantees you need.
06What is a database index and when can it hurt?
What they want to hear: Practical understanding of query performance.
Answer outline
- An index, usually a B-tree, lets the database find rows without scanning the whole table.
- Composite indexes follow column order: an index on (a, b) helps queries filtering on a, or on a and b.
- Indexes slow down writes and use storage, so add them for real queries.
- Use EXPLAIN to check whether a query actually uses the index.
07Explain ACID transactions and isolation levels.
What they want to hear: Whether you can reason about correctness when many requests touch the same data.
Answer outline
- Atomicity, consistency, isolation and durability: a transaction applies fully or not at all and survives crashes.
- Isolation levels trade safety for concurrency: read committed, repeatable read, serializable.
- Name the anomalies: dirty reads, non-repeatable reads, phantoms, lost updates.
- Example: prevent overselling stock with SELECT ... FOR UPDATE or an atomic conditional UPDATE.
08What is the N+1 query problem?
What they want to hear: A very common performance bug, especially with ORMs.
Answer outline
- Loading a list with one query, then running one extra query per item to fetch related data.
- With 100 items that is 101 queries, and latency grows with the list.
- Fix with a join, a single IN query, or the ORM's eager loading.
- Spot it with query logs or tracing that shows many similar queries per request.
09How would you migrate a large table without downtime?
What they want to hear: Experience with production change, not just greenfield work.
Answer outline
- Use expand and contract: add the new column or table first, in a backwards-compatible way.
- Deploy code that writes to both old and new, then backfill in small batches.
- Switch reads to the new structure and verify.
- Remove the old column once nothing uses it. Avoid long locks on big tables.
Scaling, caching and messaging
10How would you add caching to a slow endpoint?
What they want to hear: That you understand invalidation, the hard part of caching.
Answer outline
- Confirm the data is read much more often than it changes.
- Cache-aside: read from cache, on a miss load from the database and store with a TTL.
- Decide how to invalidate: delete on write, short TTL, or versioned keys.
- Watch for stampedes when a hot key expires; use locking or early refresh.
11When would you use a message queue?
What they want to hear: Understanding of asynchronous design and its new failure modes.
Answer outline
- To move slow or unreliable work out of the request: emails, image processing, third-party calls.
- To absorb traffic spikes and decouple producers from consumers.
- Most queues deliver at least once, so consumers must be idempotent.
- Plan for retries with backoff, a dead-letter queue and monitoring of queue depth.
12How do you scale a backend service that is reaching its limits?
What they want to hear: A structured approach: find the bottleneck before choosing a fix.
Answer outline
- Measure where the limit is: CPU, memory, database, connections or an external dependency.
- Make the service stateless so you can scale it horizontally behind a load balancer.
- Scale the database with indexes, read replicas and caching before considering sharding.
- Move heavy work to background jobs.
13Explain the CAP theorem in practical terms.
What they want to hear: Whether you can apply the idea to real design decisions rather than recite it.
Answer outline
- In a distributed system, during a network partition you must choose between consistency and availability.
- A CP system refuses some requests to stay correct; an AP system answers but may return stale data.
- Without a partition the trade-off is often between latency and consistency.
- Example: payments lean toward consistency; a social feed can tolerate staleness.
Concurrency, security and reliability
14What is a race condition and how do you prevent one?
What they want to hear: Concurrency awareness, which backend bugs often come down to.
Answer outline
- A race condition happens when the result depends on the timing of concurrent operations on shared state.
- Example: two requests read a balance, both subtract, and one update is lost.
- Prevent with atomic operations, database locks or constraints, or optimistic locking with a version column.
- Keep critical sections small to avoid contention and deadlocks.
15How do you protect an API against common attacks?
What they want to hear: Security as part of normal engineering.
Answer outline
- Use parameterised queries to prevent SQL injection and validate all input.
- Check authorization on every object access, not just authentication.
- Rate limit sensitive endpoints such as login and password reset.
- Keep secrets out of code, use TLS, and keep dependencies up to date.
16How do you make a service observable?
What they want to hear: Whether you can find out what is wrong in production without guessing.
Answer outline
- Structured logs with request ids so you can follow one request.
- Metrics for rate, errors and duration, plus saturation of key resources.
- Distributed tracing across services.
- Alerts based on user-facing symptoms, with a runbook for each.
17How do you handle a downstream service that is slow or failing?
What they want to hear: Resilience patterns and protecting your own service from cascading failure.
Answer outline
- Set timeouts on every outbound call.
- Retry only safe operations, with exponential backoff and jitter.
- Use a circuit breaker to stop calling a failing dependency for a while.
- Degrade gracefully: cached data, a default, or a clear error.
Working as a backend developer
18Tell me about a production incident you were involved in.
What they want to hear: Calm under pressure, clear communication and a blameless focus on prevention.
Answer outline (STAR)
- What broke, how it was detected and the impact.
- Your role in mitigating it, starting with the fastest way to stop the damage.
- The root cause and the fix.
- What changed afterwards: tests, alerts, process.
19Describe a time you improved the performance of a system.
What they want to hear: Measurement first, and the ability to quantify impact.
Answer outline (STAR)
- The symptom and how you measured it.
- How you found the bottleneck.
- The change and why you chose it over alternatives.
- Before and after numbers.
20Tell me about a technical decision you made that you later regretted.
What they want to hear: Honesty and learning, and whether you can talk about trade-offs in hindsight.
Answer outline (STAR)
- The decision and the reasoning at the time.
- What went wrong and when you noticed.
- How you corrected course.
- What you now consider earlier in similar decisions.
How to prepare
- Be ready to sketch a schema and the main queries for a simple domain such as orders, users and products.
- Revise HTTP semantics, status codes, idempotency and authentication flows; they come up in nearly every backend loop.
- Prepare one incident story and one performance story with concrete numbers.
- Practise explaining trade-offs in one sentence each: what you gain, what you give up.
- Know the database you list on your CV well enough to discuss indexes, transactions and query plans.
Practice these questions out loud with NORDON
Reading answers is not the same as saying them. NORDON's interview practice asks you questions written for the role, listens to your spoken answer and shows you how to make it stronger.
- Upload your CV in the Knowledge base, so questions and feedback use your real background.
- Open Practice, enter the role (for example backend developer), paste the job ad if you have it, and choose 3, 5, 8 or 10 questions and the answer language.
- Listen to each question and answer out loud, as you would in the room. You can also type an answer.
- Get a score from 1 to 10, what worked, what to improve and a stronger answer to rehearse. It uses only what you said and your documents, and leaves a [placeholder] where a fact about you is missing.
- Try the question again, or move on. For a dress rehearsal, run a mock call where an interviewer voice asks the questions out loud.
The free plan includes 10 scored practice answers a month and mock calls of up to 10 minutes, no card needed. Paid plans include more practice and mock calls of up to 30 minutes. How practice works
Practice is for preparing. Use live help in a real interview only where the interviewer allows AI assistance, never in an interview, test or assessment whose rules forbid it.
Preparing for your backend developer interview
What does a backend developer interview usually include?
Commonly a coding round, a discussion of APIs and databases, and for mid-level and senior roles a system design round, plus behavioral questions. The exact format differs between companies, so ask the recruiter what to expect.
How much system design do I need for a backend role?
For junior roles, a basic understanding of APIs, databases and caching is often enough. For mid-level and senior roles, expect a full design round where you take a vague problem through requirements, data model, scaling and trade-offs.
Should I know a specific language or framework?
Know the one in the job description well if you can, but strong fundamentals in HTTP, databases and concurrency carry over between languages and usually matter more.