Advanced interview questions in Backend Dev, page 3
Modularizing routes with express.Router
Create a Router instance in users.js, attach routes to it, export it, then mount it under a base path with app.use in the main file.
Custom API key auth middleware
Read the header from req, on missing or invalid send res.status(401) and return, on valid call next, mount before protected routes.
Centralized error-handling middleware
Error middleware takes four args err, req, res, next, is defined last, and runs when next(err) is called or sync errors throw.
The three phases of ARIES recovery
Analysis rebuilds dirty-page and transaction tables from the last checkpoint, Redo replays all logged changes to restore state, Undo rolls back losers; Redo is idempotent via per-page LSN comparison so…
Row-oriented versus columnar storage
Row stores keep whole rows together, ideal for point reads and writes; columnar stores keep each column contiguous, enabling reading only needed columns and strong compression, ideal for scans and…
Using page LSN to decide redo
Each page stores the LSN of its last applied change; during redo the engine reapplies a log record only if its LSN exceeds the page's LSN, meaning the change is not yet reflected on disk.

How would you implement a dependency requiring multi-source parameters?
Tests if you know FastAPI resolves dependency params like endpoint params. Great answers annotate each parameter with its source inside the dependency so FastAPI injects them independently. Red flag: manually parsing Request or merging values in the endpoint.

How does lifecycle differ for global vs path operation dependencies?
Global deps run on every request to any route; path-local deps run only for that route; expensive setup belongs in a lifespan event or cached singleton, not a dependency.

Explain the internal role of the Depends class
A strong answer notes it marks parameters for solver, enables recursive sub-dependencies and Annotated sharing, and feeds OpenAPI.
Design a custom Go error type with context, Is, As, and Unwrap
This tests Go 1.13 error wrapping and Unwrap conventions. Answer: struct with Err and context fields; implement Error and Unwrap; note errors.Is and errors.As walk the chain. Red flag: stringifying the error via fmt.Errorf %v, which severs unwrapping.
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.
Write a JWT authentication middleware
Read the header, strip Bearer, jwt.verify with the secret, set req.user and next(), else send 401.
How does a hash join handle memory overflow?
The build table is partitioned by hash and spilled to disk, then probe rows are partitioned the same way, and pairs are joined per partition.
Conditionally apply middleware by request property
Use express.text({ type: 'application/xml' }) or a guard wrapper that checks req.is() then calls the parser or next().
How do you dynamically discover and register FastAPI routers from a directory?
Scan app/routers/ with importlib, validate APIRouter objects, include_router with prefixes, and isolate failures.
Describe Rust's orphan rule and its ecosystem purpose
State that either trait or type must be local; explain this stops conflicting foreign impls; note crates.io would see silent impl collisions breaking downstream builds.
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.
How do you manage service lifecycle with FastAPI Depends versus formal DI?
Tests scaling FastAPI DI beyond routes. Answer: use Depends(yield) for request-scoped DB sessions; use a formal container for deep singleton service graphs and lifespan wiring; hybrid is best. Red flag: using Depends for everything and ignoring testability.
Override a FastAPI dependency at the APIRouter level
Tests FastAPI DI scoping limits. Answer: APIRouter has no dependency_overrides; create a sub-app, apply overrides, mount it. Red flag: Claiming router-level overrides exist or mutating global app state.
How do you keep consistency without multi-document transactions?
A Saga runs a sequence of local transactions, each with a compensating action to undo on failure, coordinated via choreography or orchestration.
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