Module 08 Knowledge Check
5 questions. Pass mark 4 out of 5. Answer every question before checking the answer key below, then retry after reading the feedback.
1. Routers should be split by…
- A. HTTP method
- B. resource
- C. response type
- D. author
2. A service raising HTTPException…
- A. is convenient and correct
- B. makes the service depend on FastAPI
- C. is required for error handling
- D. improves the status codes
3. Domain exceptions are mapped to status codes…
- A. in each handler
- B. in one place in the router layer
- C. by FastAPI automatically
- D. in the service
4. The model provider should appear in…
- A. every service that needs it
- B. one client module
- C. the settings only
- D. the router
5. A project structure is good when…
- A. it has few directories
- B. a newcomer finds the right file unaided
- C. it follows a framework convention
- D. it minimises imports
---
Answer Key and Explanations
Check these only after attempting every question.
1. B - resource
Everything about invoices then lives in one file.
2. B - makes the service depend on FastAPI
It can no longer be called from a worker without a web framework.
3. B - in one place in the router layer
So every endpoint translates the same exception the same way.
4. B - one client module
Otherwise the vendor's types spread through your logic.
5. B - a newcomer finds the right file unaided
Not elegance - whether 'where does X go?' has one predictable answer.
Practical Check
Apply this module to your own work: complete the module activity for *Routers, Larger Project Structure and Service Layers*, then write one sentence naming what your result shows and one naming what it does not.
Strong Answer Pattern
A strong answer names the task, the evidence used, the check performed, and the remaining limitation. It avoids "proved", "guaranteed", or "always" unless the evidence genuinely supports it.
