Skip to content
tezvyn:

⚙️Backend Dev

Backend engineering, APIs, and databases

533 bites

Test yourself: Top 30 Backend Dev interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Interview questions in Backend Dev, page 17

easy2 min read

Purpose of await next(request) in FastAPI middleware and timing effects

Tests ASGI middleware lifecycle. await next(request) forwards the request downstream to the endpoint and returns the response. Pre-call code touches the request; post-call code touches the response.

easy2 min read

What is go test -race and when is it crucial?

This tests knowledge of Go's race detector. A strong answer says -race instruments code to detect racy reads/writes, finds data races not deadlocks, and is crucial for concurrent apps under load.

intermediate1 min read

Mocking the database layer in Jest unit tests

A live DB makes tests slow, flaky, and order-dependent; use jest.mock on the model so methods return controlled fakes.

intermediate1 min read

Pooled connection lifecycle and close() semantics

Borrow from pool, use, then close() returns it to the pool rather than tearing down the socket.

intermediate2 min read

Write a FastAPI middleware that adds X-Process-Time header

Tests FastAPI lifecycle and header mutation. Strong answers use the http middleware decorator, await call_next, compute elapsed time, and inject X-Process-Time before returning. Red flag: forgetting to await call_next or mutating headers after the return.

intermediate2 min read

How do you use ResetTimer, StopTimer, and RunParallel in Go benchmarks?

Tests Go benchmark timer hygiene and parallel execution. A strong answer covers b.StopTimer before setup, b.ResetTimer before the loop, and b.RunParallel for CPU-bound scaling. A red flag is resetting without stopping or using parallel benchmarks for I/O.

intermediate1 min read

Testing async Promise-returning code in Jest

Return or await the promise; use await expect(...).resolves/rejects, or await the value directly.

intermediate1 min read

Eager vs lazy loading in an ORM

Eager fetches related data up front (joins/extra query); lazy defers until accessed. Lazy in a loop causes the N+1 query problem.

intermediate2 min read

Which FastAPI CORSMiddleware parameters beyond allow_origins fix a PUT preflight?

Configure allow_methods for PUT and allow_headers for Authorization so the browser approves the cross-origin call.

intermediate2 min read

Generate a Go CPU profile and visualize it as a flame graph

This tests Go profiling workflow and flame graph literacy. A good answer covers net/http/pprof setup, go tool pprof collection, flame graph generation, and reading width as cumulative CPU time and height as call depth. Red flag: width means call count.

intermediate1 min read

Propagating a correlation ID without parameter passing

Middleware reads or generates the header, stores it in a contextvars.ContextVar, service code reads it anywhere, and logging filters inject it.

advanced1 min read

Managing clean test state across API integration tests

Compare seed-and-truncate, per-test transaction rollback, and in-memory or containerized databases, weighing fidelity, speed, and isolation.

intermediate1 min read

Transaction isolation levels and their tradeoffs

Isolation levels control which concurrency anomalies (dirty/non-repeatable reads, phantoms) are allowed; higher levels mean stronger consistency but more blocking and less concurrency.

intermediate2 min read

Explain fuzz testing and set up a basic fuzz test

This tests coverage-guided fuzzing and toolchain wiring. Strong answer: defines fuzzing as automated input mutation driven by code coverage, contrasts it with hand-written examples, and sketches Go's FuzzXxx or Rust's cargo-fuzz setup.

intermediate1 min read

BackgroundTasks dependency vs response.background

The injected BackgroundTasks parameter lets endpoints and dependencies stack tasks and is the common path; response.background attaches a single Starlette task when you return a Response object…

advanced1 min read

Testing code that calls a third-party API

Intercept at the HTTP boundary (nock) or run a local mock server; cover success, errors, timeouts, and assert request shape.

advanced1 min read

Unit of Work / Session pattern in ORMs

The Unit of Work tracks new, dirty, and deleted objects, then flushes them as one batched transaction at commit.

advanced1 min read

Diagnosing Go memory leaks with pprof heap profiles

Expose net/http/pprof, grab /debug/pprof/heap, analyze inuse_space for live retention versus alloc_space for cumulative allocation; rising inuse over time points to a leak.

advanced1 min read

Testing an async workflow that spans DB and message queue

Assert the DB row, then verify the queue message via a test consumer or spy, polling with a timeout rather than fixed sleeps.

advanced1 min read

Fixing an ORM's inefficient aggregation query

Drop to raw SQL or a view for the heavy report, or restructure the ORM query and add indexes. Raw SQL is fast but couples to the schema; tuning keeps portability.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles