codejump

Dependency Graphs & Reuse — Series 2

Preview — 3 of 10 questions

get_profile depends on get_user, which depends on get_token. Which function can run first?

Aget_profile
BThe route handler
Cget_token
DAny of them, in random order

A route consumes get_user and get_team; both depend on the same get_db callable. With default caching, how often does get_db normally run per request?

AOnce
BTwice
COnce per server process
DOnly when an exception occurs

Two Checker("admin") instances are separately constructed and passed to Depends on the same route. Are they automatically the same dependency cache entry?

AYes, because their constructor arguments match
BYes, because both are instances of Checker
CYes, because all dependencies share one result
DNo, they are separate callable instances

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.