Skip to content
Sharp

FastAPI · interview question

A bug appears around route handlers. What is the strongest first debugging move?

Multiple choiceEasychapter-13-curatedpremiumfastapiroute-handlers
python
from fastapi import FastAPI

app = FastAPI()

@app.get("/orders/{order_id}")
def get_order(order_id: str) -> dict[str, str]:
    return {"order_id": order_id}
Choose one answer
Answer and explanation

Correct answer

D. Trace one concrete example, inspect the state transitions, and compare them to the intended rule before rewriting anything.

Why

That approach is reliable because it creates evidence. If route handlers own all the business logic, testing and refactoring become harder quickly.

Test yourself on FastAPI

A free test with instant, explained results. No account needed.

Start free test
All FastAPI questions →