
APIs and HTTP
- What happens on the server side when someone loads a page of your app? A good answer follows the request through DNS, TCP and TLS, the load balancer, the application and the database, and says where caching can cut the trip short. Depth on the part closest to the job beats a long list.
- When would you choose REST, GraphQL or gRPC for a new API? A good answer gives trade-offs, not a favorite: REST for simple resources and HTTP caching, GraphQL when clients need flexible shapes, gRPC for internal calls with strict contracts and streaming.
- How do you make an endpoint safe to retry? A good answer describes an idempotency key stored with the first result, so a repeated request returns that result instead of doing the work twice, and knows which HTTP methods are idempotent by definition.
- How would you version an API that mobile apps depend on? A good answer knows old app versions stay installed for months: additive changes, a deprecation window, a version in the path or a header, and measuring who still calls the old version before removing it.
- How do you paginate a list that changes while people page through it? A good answer prefers cursor pagination over offsets, explains why offsets skip or repeat rows when items are inserted, and sorts by a stable, unique key.
- Which status codes do you return for a validation error, missing sign-in and a rate limit? A good answer gives 400 or 422, explains 401 (not signed in) against 403 (signed in, not allowed), and returns 429 with a Retry-After header. Consistency across the API matters more than the exact pick.
Databases
- How do you decide what to index? A good answer starts from the queries: the columns in filters, joins and sorting, the order of columns in a composite index, the cost on writes, and checking the query plan. See database indexes in plain words.
- Explain transaction isolation levels with an example of what goes wrong. A good answer names at least one anomaly, such as a lost update or a phantom read, shows how a stricter level or a row lock prevents it, and knows the default of the database they use, for example read committed in PostgreSQL.
- What is the N+1 query problem, and how do you find it in production? A good answer explains the loop that runs one query per row, fixes it with a join or batching, and finds it by counting queries per request or reading traces. See the N+1 problem in plain words.
- How would you add a column to a very large table without downtime? A good answer uses expand and contract: add the column as nullable, backfill in batches, write to both, switch reads, then remove the old path, and avoids statements that lock the table for long. See migrations in plain words.
- SQL or NoSQL for a new feature: how do you decide? A good answer looks at the shape of the data, the queries, the consistency the feature needs and what the team can operate, and avoids the slogan that only NoSQL scales.
- How do you store money in a database? A good answer uses integer minor units or a decimal type, never floating point, stores the currency with the amount, states the rounding rule, and records changes as ledger entries instead of editing a balance.
- The database CPU is at 95 percent. What do you look at first? A good answer checks the top queries by total time, recent deploys, missing indexes, lock waits and connection counts, and fixes the biggest offender before buying a bigger machine.
Reliability and scale
- How would you design a rate limiter? A good answer picks a token bucket or a sliding window, says where the counters live, chooses the key (user, API key or address), returns 429 with a wait time, and decides whether to fail open or closed. See rate limiting in plain words.
- What should your service do when a service it calls becomes slow? A good answer puts a timeout on every call, retries only safe operations with backoff and jitter, adds a circuit breaker, and returns a fallback or a clear error. See retries and backoff.
- Where would you put a cache, and how do you keep it correct? A good answer explains cache-aside, expiry times, invalidation on write and what stale data costs for this feature, and mentions many requests missing the cache at once. See caching in plain words.
- When would you add a message queue? A good answer uses it to absorb spikes, move slow work out of the request and retry safely, and names the costs: at-least-once delivery, ordering, consumers that must be idempotent and a dead-letter queue. See message queues in plain words.
- How do you make a background job safe to run twice? A good answer keys the work by a job or event id, uses a unique constraint or a processed marker, and keeps each transaction small so a retry does not repeat side effects.
- Latency at the 99th percentile doubled after a deploy. How do you find out why? A good answer compares before and after by endpoint, reads traces of slow requests, checks new queries and external calls, and is ready to roll back first and investigate after.
Security
- How do you store passwords? A good answer uses a slow, salted hash made for passwords, such as bcrypt, scrypt or Argon2, never encryption or a fast hash, and adds rate limits on sign-in.
- What is SQL injection, and how do you prevent it in code you did not write? A good answer uses parameterized queries everywhere, treats input validation as an extra layer, and searches the codebase for queries built from strings.
- Sessions or tokens for signing users in? A good answer weighs the trade-offs: server sessions are easy to revoke, stateless tokens need short lifetimes and refresh tokens, and where the browser stores the token changes the risk.
- How do you keep secrets out of the repository? A good answer uses environment variables or a secret manager, scans commits, rotates anything that leaked and gives each environment its own least-privilege key.
Code, tests and reviews
- How do you test code that calls a third-party API? A good answer wraps the API in a thin client, uses fakes or recorded responses in unit tests, keeps a few sandbox tests, and tests the provider's errors on purpose.
- What makes a pull request easy to review? A good answer keeps it small and about one thing, explains why in the description, includes tests that show the behavior and points reviewers at the risky part. See walking a team through your pull request.
- How do you fix a bug in a codebase you have never seen? A good answer reproduces it first, finds the entry point, follows the request through the code, writes a failing test and changes as little as possible. See questions about code you did not write.
- When is it worth refactoring before you add a feature? A good answer refactors when the change would otherwise be scattered or unsafe, keeps the refactor in separate commits and gets tests in place first.
Behavioral, for backend roles
- Tell me about an outage you were part of. A good answer covers what broke, what they did in the moment, how the cause was found and the change that stopped it from happening again, and owns their part without blaming anyone. See blameless postmortems.
- Tell me about a technical decision you would make differently now. A good answer names the constraint at the time, what they learned and what they changed: judgment, not regret.
- How do you explain a backend trade-off to a product manager? A good answer uses plain words, the effect users will notice, the cost in time or risk, and ends with a recommendation. See explaining technical work.
How to practice these
- Pick the five questions you would find hardest, not the ones you already know.
- Answer each one out loud in about two minutes, and record yourself if you can.
- Compare your answer with the note: did it cover what a good answer shows?
- For every question, write down one real example from your own work that you could use.
For interviewers: the notes work as a scoring guide. Decide before the interview what a strong answer covers, and score the evidence you heard, not the confidence it was said with. See how to run a fair technical interview.
More roles and the questions every engineer gets: interview questions by role.