All quizzesHard
Lifecycle & Production Behavior — Series 3
Preview — 3 of 10 questions
A yield dependency with scope="function" opens a resource. When does its cleanup run?
AAfter the handler returns but before sending the response
BOnly when the application shuts down
CAfter all background tasks finish
DBefore resolving sub-dependencies
A custom Response is returned directly from a route that declares response_model=ItemOut. Which behavior matters?
AThe Response is always converted to ItemOut
BFastAPI reruns request validation on the body
CThe response status is forced to 422
DDirect Response content bypasses normal response-model serialization
Why might response_model_exclude_unset=True still include a field equal to its model default?
AThe field is a path parameter
BThe response is always a list
CThe field was explicitly supplied in the source data
DDefaults are never excluded
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.