Skip to content
tezvyn:

⚙️Backend Dev

Backend engineering, APIs, and databases

280 bites

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

Advanced everything in Backend Dev, page 5

advanced1 min read

Profiling a Rust hot loop with perf

Build with debuginfo, perf record cycles or cache-misses, perf report then perf annotate to map counters to source/asm; flamegraph for hotspots.

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

Cancellation: Go context vs Rust sync stdlib

Go's context.Context threads a Done channel and deadline through call chains; Rust std has no built-in cancellation, so you wire an AtomicBool or channel and check it.

advanced1 min read

Network read/write timeouts in Go vs Rust stdlib

Go uses SetReadDeadline/SetWriteDeadline as absolute times; Rust uses set_read_timeout/set_write_timeout as durations on TcpStream.

advanced1 min read

Purpose and mechanism of a Rust build.rs script

Build.rs compiles and runs before the crate, emitting cargo: directives via stdout to set link flags, env vars, and rerun triggers; used to compile C, generate code, or probe the system.

advanced1 min read

Associated types vs generic type parameters in traits

Associated types fix one type per implementer; generics allow many impls; Iterator::Item is the canonical example.

advanced1 min read

When to panic in Go versus Rust

Both reserve panic for unrecoverable bugs and use values, Result or error, for expected failures; Rust's type system pushes more cases to Result.

advanced1 min read

Rust workspace versus single crate for plugins

A workspace gives incremental compilation, enforced API boundaries via a shared api crate, and per-plugin deps; a single crate is simpler but recompiles wholesale and blurs boundaries.

advanced1 min read

I/O Stream Abstractions

I/O stream abstractions like Go's io.Reader and io.Writer model data as a flow of bytes behind a tiny interface, so files, sockets, buffers and encoders compose interchangeably without each one knowing the others' concrete type.

How do you inspect WebSocket close codes in FastAPI?
advanced2 min read

How do you inspect WebSocket close codes in FastAPI?

Tests WebSocket lifecycle handling in FastAPI. Strong answers catch the disconnect exception, read its code attribute, and log 1000 for normal closures versus 1001/1006 for crashes.

advanced2 min read

How do you handle slow startup without blocking the FastAPI event loop?

It tests FastAPI lifespan events and event loop hygiene. Use an async lifespan to offload blocking model loading to a thread pool, track readiness with a global flag, and return 503 for early requests. Never block the event loop in startup handlers.

How do you broadcast WebSocket messages to all clients across server nodes?
advanced2 min read

How do you broadcast WebSocket messages to all clients across server nodes?

Tests WebSocket horizontal scaling and pub/sub backplanes. A strong answer names a broker like Redis, describes cross-node fan-out, and keeps connection state purely local.

advanced2 min read

How do you directly modify FastAPI's generated OpenAPI dictionary?

Tests deep FastAPI lifecycle knowledge. Override app.openapi: save the original, call it to get the dict, mutate it, cache on app.openapi_schema, and return. Red flag: rewriting /openapi.json in middleware or touching the schema cache directly.

How do you disable FastAPI docs but keep the OpenAPI schema?
advanced2 min read

How do you disable FastAPI docs but keep the OpenAPI schema?

Tests FastAPI constructor routing: docs_url, redoc_url, and openapi_url. Answer: pass docs_url=None and redoc_url=None while keeping openapi_url="/openapi.json", gated by env var. Red flag: middleware or manual route deletion instead of native configuration.

Add a custom x- field to a FastAPI path operation schema
advanced2 min read

Add a custom x- field to a FastAPI path operation schema

Tests knowledge of FastAPI's built-in OpenAPI extension hook. Answer: cite the path operation decorator's extra-schema dict (OpenAPI Extra) to merge x-internal-id directly. Red flag: proposing manual JSON editing or schema post-processing.

advanced2 min read

How do router-level and app-level dependencies affect dependency override testing?

This tests FastAPI dependency hierarchy and test isolation. A strong answer states overrides are global to the app, so router-specific deps need scoped fixtures to prevent cross-test leaks. A red flag is claiming APIRouter has its own override registry.

advanced2 min read

How do you test a FastAPI WebSocket endpoint and lifecycle with pytest?

Tests knowledge of FastAPI TestClient usage for async WebSocket lifecycles. Use a with statement for websocket_connect; assert send, receive_json, and close; tests use standard def because TestClient handles the async app.

advanced2 min read

How do you test FastAPI background tasks are enqueued correctly?

This tests mocking framework hooks without firing side effects. A great answer: mock BackgroundTasks or override its dependency, assert add_task got the right function and payload, and test the sender separately.

Design DB transaction middleware and identify the background-task pitfall
advanced2 min read

Design DB transaction middleware and identify the background-task pitfall

Tests request-scoped DB lifecycle awareness. Strong answer: middleware closes the session on response, yet BackgroundTasks run afterward, so sharing that session causes crashes or leaks. Red flag: saying background tasks can reuse the request transaction.

advanced2 min read

Why is FastAPI BackgroundTasks poor for multi-minute PDF generation?

Tests whether you know BackgroundTasks is same-process and for seconds, not minutes. Answer: propose a task queue with broker, workers, and result backend; return HTTP 202 with a job ID. Red flag: suggesting FastAPI workers instead of persistence and retries.

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