Interview questions in Backend Dev, page 14
Apply the CAP theorem to a real system
Define C, A, P; note partitions are unavoidable, so the real choice during one is consistency versus availability; then classify a system as CP or AP with reasoning.

Why synchronous DB libraries block async FastAPI endpoints and correct SQLAlchemy usage
This tests event loop blocking: sync DB calls in async def halt all requests. Answer: sync drivers block the loop despite releasing the GIL; use asyncpg with SQLAlchemy create_async_engine and AsyncSession. Red flag: recommending run_in_executor as default.
Explain Cargo features and how to define and enable them
This tests conditional compilation and optional dependency design in Rust. A strong answer outlines the [features] table, cfg attribute gating, and consumer enablement via --features or default features.
Session-based versus token-based authentication
Sessions store server-side state with a cookie id, tokens carry self-contained claims with no server store, weigh revocation versus scalability, especially across services.
Range-based vs hash-based sharding trade-offs?
Range sharding keeps ordered keys together, great for range scans but prone to hot spots on sequential keys; hash sharding spreads keys evenly, avoiding hot spots but killing efficient range…
Implement a PATCH endpoint for partial SQLAlchemy updates
Tests PATCH vs PUT and selective ORM updates. Strong answer: all-optional update schema, load existing record, iterate exclude_unset=True fields with setattr, commit. Red flag: updating without excluding unset, which overwrites missing fields with None.
How do you manage multiple related Rust crates as a single unit?
Tests Cargo workspaces for multi-crate Rust projects. Strong answers cite the [workspace] section, shared Cargo.lock, unified target directory, inherited metadata, and workspace-wide commands.
MongoDB async ODM vs SQLAlchemy sessions
Motor client as a connection pool with no SQLAlchemy-style session or transaction; Beanie document models over Motor; initialize once at startup and await find queries.
Securing Express with Passport local strategy
Configure LocalStrategy with a verify callback, call passport.authenticate as route middleware, and set up serializeUser/deserializeUser for sessions.
Leader-follower vs multi-leader replication
Single-writer leader-follower is simple but a write bottleneck; multi-leader accepts writes in many regions for latency and availability.
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.
Role-based access control middleware in Express
Authenticate first to set req.user, then a parameterized role-check middleware that compares req.user.role and returns 403 if it fails, applied to protected routes.
What is eventual consistency?
Replicas converge to the same value if writes stop, allowing temporary staleness for higher availability and lower latency.
How do you atomically create an order and update inventory?
Tests transaction boundaries and SQLAlchemy 2.0 session lifecycle in FastAPI. A strong answer wraps both writes in session.begin(), flushes to catch constraint errors early, and uses exceptions to trigger rollback.
What does go mod tidy do beyond adding dependencies?
Tests reproducible Go module graph knowledge. A strong answer covers that tidy reconciles imports with go.mod, prunes unused modules, and ensures go.sum contains every checksum for the minimal build list.
SQLAlchemy connection pooling across Uvicorn workers
Each worker has its own pool; total DB connections equal workers times (pool_size plus max_overflow); overflow connections are temporary; misconfiguration exhausts DB…
Strategies for revoking stateless JWTs
Short-lived access tokens with refresh-token rotation, or a server-side denylist of revoked token ids, weighing statelessness against immediacy.
Durable write path in a sharded KV store
Route by key hash to the shard leader, append to WAL and fsync, replicate to two followers, ack on quorum, then confirm.
Read a file into a byte slice in Go and Rust
This tests standard-library convenience APIs for slurping files. In Go, use os.ReadFile (1.16+) returning ([]byte, error). In Rust, use std::fs::read returning Result<Vec<u8>>. A red flag is opening a file and looping over reads when a one-liner exists.
JWT storage: localStorage versus httpOnly cookies
LocalStorage is readable by JS so XSS can steal the token but no CSRF; httpOnly cookies block XSS theft but are auto-sent, enabling CSRF unless mitigated.
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