18 real Dependency Injection questions from the FastAPI bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.
1. What is Depends?
Junior
A.a dependency that itself declares Depends on another, forming a resolved chain of providers
B.the marker that declares a callable whose result the framework resolves and injects as a handler argument
C.the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result
D.a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session
A.Per-request dependency caching — the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value
B.Per-request dependency caching — the marker that declares a callable whose result the framework resolves and injects as a handler argument
C.Per-request dependency caching — the default behavior where a provider called more than once in a single request is executed only once and its result reused
D.Per-request dependency caching — a dependency that itself declares Depends on another, forming a resolved chain of providers
11. Which term means: "a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session"?
A.Yield dependency — the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value
B.Yield dependency — a dependency that itself declares Depends on another, forming a resolved chain of providers
C.Yield dependency — the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result
D.Yield dependency — a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session
A.Path operation dependencies list — the marker that declares a callable whose result the framework resolves and injects as a handler argument
B.Path operation dependencies list — the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value
C.Path operation dependencies list — a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session
D.Path operation dependencies list — the default behavior where a provider called more than once in a single request is executed only once and its result reused
A.use_cache disabled — a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session
B.use_cache disabled — the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result
C.use_cache disabled — a dependency that itself declares Depends on another, forming a resolved chain of providers
D.use_cache disabled — the marker that declares a callable whose result the framework resolves and injects as a handler argument
Answers, AI explanations, and a scored voice mock interview
Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.