Skip to content
Sharp

Service Design · interview question

What does a strong engineer do when reasoning through dependency injection code?

Multiple choiceMediumchapter-13-curatedpremiumservice-designdependency-injection
python
from fastapi import Depends

def get_repo() -> OrderRepository:
    return OrderRepository()

@app.get("/orders")
def list_orders(repo: OrderRepository = Depends(get_repo)) -> list[dict]:
    return repo.list_recent()
Choose one answer
Answer and explanation

Correct answer

C. Narrate the data shape, the state changes, and the exact rule order step by step.

Why

Interviewers often use simple code to test whether you can reason through execution without bluffing.

Test yourself on Service Design

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

Start free test
All Service Design questions →