Interviews
Backend Developer Interview Questions and Answers for 2026
August 15, 2026 · 8 min read · Upleva team

You explain the endpoint you built, and the interviewer asks one small follow-up: what happens if two requests arrive at the same time? Suddenly your neat CRUD project has race conditions, retries, indexes, and a mildly alarming amount of reality. That is normal. Backend interviews often start with familiar code and then test what happens when the data is messy, the network is unreliable, or traffic jumps tenfold.
The best preparation is not memorizing fifty definitions. It is practicing how you make decisions. For each question below, you will see a junior-level answer and a senior-level answer to the same problem. Neither is a script. Use the depth that matches your experience, and say what you would verify instead of pretending you know everything.
Data modeling and database interview questions
1. How would you model users, orders, and products?
Junior answer: I would create separate users, orders, and products tables. An order would have a user_id, and I would use an order_items table for the many-to-many relationship between orders and products. Each order item would store the product_id, quantity, and price at the time of purchase, because the product price might change later. I would add primary keys, foreign keys, and basic indexes on user_id and order_id.
Senior answer: I would start by clarifying the business rules: can a product be deleted after purchase, can an order contain changing prices, and do we need historical customer details? I would separate the current product catalog from the purchase snapshot. The order item would retain product name and price as purchased, even if the catalog changes. I would enforce foreign keys where lifecycle rules allow them, choose numeric types carefully for money, and add indexes based on query patterns rather than indexing every column. I would also consider order state transitions and whether they need an audit table.
The useful distinction is not that the senior answer contains more database vocabulary. It connects the schema to real behavior. A good follow-up is: what breaks if the product is removed? Explain your choice, then mention the tradeoff.
2. When would you use an index, and when could it hurt?
Junior answer: I would add an index to columns frequently used in WHERE clauses, joins, or sorting. For example, an index on orders.user_id could help retrieve a user’s orders. Indexes make reads faster, but they use storage and can slow inserts and updates because the index must also be changed.
Senior answer: I would inspect the actual query plan and workload first. A composite index can help a query such as WHERE tenant_id = ? AND created_at > ?, but column order matters. I would consider selectivity, sort behavior, write volume, and whether the query is covered by the index. I would also check for stale statistics and low-value indexes. Then I would measure before and after, because an index that looks sensible on paper can be ignored by the optimizer or become expensive at production scale.
A compact rule for database interview questions: name the query, the expected data size, and the cost of writes. If you only say indexes make things faster, the interviewer has an obvious next question.
3. What is a transaction, and when would you use one?
Junior answer: A transaction groups related database operations so they either all succeed or all roll back. I would use one when transferring money or creating an order and its items. That prevents a partial result, such as an order without its order items.
Senior answer: I would define the invariants first. For a transfer, the balance changes and ledger entries must remain consistent, so I would use a transaction with an appropriate isolation level and constraints. I would keep the transaction short, avoid network calls inside it, and think about deadlocks and retry behavior. A database transaction cannot automatically make an external payment service part of the same atomic operation, so I would use an idempotency key and an explicit state machine for that boundary.
API design interview questions
4. Design an API for creating and retrieving orders.
Junior answer: I would use POST /orders to create an order and GET /orders/{id} to retrieve one. The request would include product IDs and quantities. I would validate required fields, return 201 Created for a successful creation, 400 for invalid input, and 404 when an order does not exist. Authentication would come from the logged-in user rather than a user ID supplied by the client.
Senior answer: I would clarify whether creation is synchronous, whether prices are calculated by this service, and whether clients may retry. I would make POST /orders idempotent with a client-provided idempotency key, or document why retries are unsafe. I would define an explicit request and response schema, authorization rules, stable error codes, pagination for collection endpoints, and a versioning policy. I would avoid returning internal database fields by accident and would consider an outbox or event mechanism if downstream services need reliable order-created notifications.
For API design interview questions, walk through one successful request and two failed ones. For example: invalid quantity returns a structured validation error; a duplicate idempotency key returns the original result; an authenticated user requesting someone else’s order gets a forbidden response or a deliberately non-revealing not-found response.
5. How would you handle API rate limiting?
Junior answer: I would limit requests per user or IP over a time window. If the limit is exceeded, the API returns HTTP 429 and the client can retry later. The limit should be configurable, and the response can include a Retry-After header.
Senior answer: I would first identify the protected resource and the identity used for limiting. IP-only limits can punish users behind shared networks, while user-only limits do not help unauthenticated endpoints. A token bucket or leaky bucket could control bursts. In a multi-instance service, the counter needs shared, atomic storage, such as a suitable Redis operation, and the failure mode must be explicit: fail open or fail closed if that store is unavailable. I would return useful headers, monitor rejected traffic, and apply stricter limits to expensive operations.
Do not start with the algorithm. Start with the abuse case, the identity, the burst allowance, and what happens when the limiter itself fails. That order makes your reasoning much easier to follow.
What happens under load?
6. An endpoint is slow in production. How do you investigate?
Junior answer: I would reproduce the issue if possible, check logs and response times, and look for slow database queries or errors. I would check whether a recent code change caused it. Then I would make a small fix, test it, and monitor the endpoint after deployment.
Senior answer: I would establish the scope first: which route, region, customers, status codes, and time window are affected? I would compare latency percentiles, traces, database timings, cache hit rates, connection pool usage, CPU, memory, and queue depth. I would check for an N+1 query, lock contention, an exhausted pool, a dependency timeout, or a traffic change. I would mitigate safely, perhaps by rolling back or reducing expensive work, then find the root cause with a representative trace. Afterward I would add a regression test, an alert tied to user impact, and a capacity or failure-mode improvement.
A junior candidate does not need to name every observability tool. They do need to avoid guessing. A strong sentence is: I would measure where the time is spent before choosing a fix.
7. How do you prevent duplicate requests from creating duplicate records?
Junior answer: I would validate the request and check whether a matching record already exists. I would also add a unique database constraint so two requests cannot create the same record at the same time. The API should return a clear response for a duplicate.
Senior answer: A read-then-write check alone has a race condition. I would use an idempotency key tied to the authenticated client and operation, store the key with the result, and enforce a unique constraint at the database layer. Concurrent requests should be serialized or one should receive the existing result. I would define how long keys remain valid, what happens after a timeout, and whether the original request can safely be retried. If the workflow crosses services, I would make each consumer idempotent rather than trusting a single distributed lock.
How to answer backend questions when you are unsure
Short technical screens often focus less on difficult algorithms and more on whether you can explain your own project, debug carefully, and notice edge cases. Be ready to discuss deployment, environment variables, authentication, error handling, tests, and what you would change now. Your project is not a museum exhibit. The interviewer is allowed to open the cupboards.
- Clarify the requirement before designing. Ask about traffic, consistency, data retention, security, and failure tolerance.
- Think aloud in decisions, not noise. Say: I am choosing this because..., and the tradeoff is....
- Separate certainty from investigation. Say: I would check the query plan rather than claiming the index will definitely help.
- Use layered answers. Start with a safe simple design, then explain what you would add as traffic, reliability, or team needs grow.
- Name failure cases: retries, timeouts, partial writes, concurrent updates, stale cache data, and unavailable dependencies.
If you need broader coverage, the software engineer interview questions and answers provide a useful companion for coding, systems, and behavioral topics. Frontend candidates can use the frontend developer interview guide to compare how client-side concerns change the conversation.
A good backend answer does not promise that the system never fails. It shows what fails, how you detect it, and how you keep one bad request from becoming everybody’s problem.
For practice, pick one project from your resume and answer each question against it. Draw the tables. Write the endpoint. Explain the slow query. Then ask yourself what happens when the request arrives twice. That exercise is more useful than reciting a definition of normalization into the void.
Upleva Interviews can run live voice mock interviews from your resume and target role, with per-question reports, coach notes, and a transcript, so you can practice explaining these tradeoffs out loud before the real conversation.
Finally, match your depth to your level. A junior answer should be concrete, correct, and honest about what you would investigate. A senior answer should connect technical choices to scale, reliability, ownership, and tradeoffs. You do not need to sound like a distributed-systems textbook. You need to sound like someone who notices what can go wrong and has a plan for finding out.