Dependency Injection interview questions

18 Dependency Injection questions from the FastAPI bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Free to start: the 2-minute IT readiness check — six questions and a result.

Take the free IT readiness check

or take a mock interview set up for this area

1. What is Depends?

Junior
  1. A.a dependency that itself declares Depends on another, forming a resolved chain of providers
  2. B.the marker that declares a callable whose result the framework resolves and injects as a handler argument
  3. C.the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result
  4. D.a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session

Answer + AI explanation with Pro

2. Which term means: "the marker that declares a callable whose result the framework resolves and injects as a handler argument"?

Junior
  1. A.Path operation dependencies list
  2. B.Depends
  3. C.Yield dependency
  4. D.Sub-dependency

Answer + AI explanation with Pro

3. Which statement is correct?

Junior
  1. A.Depends — a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session
  2. B.Depends — the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result
  3. C.Depends — the marker that declares a callable whose result the framework resolves and injects as a handler argument
  4. D.Depends — the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value

Answer + AI explanation with Pro

4. What is Sub-dependency?

Mid
  1. A.the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result
  2. B.the marker that declares a callable whose result the framework resolves and injects as a handler argument
  3. C.a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session
  4. D.a dependency that itself declares Depends on another, forming a resolved chain of providers

Answer + AI explanation with Pro

5. Which term means: "a dependency that itself declares Depends on another, forming a resolved chain of providers"?

Mid
  1. A.Depends
  2. B.Yield dependency
  3. C.Sub-dependency
  4. D.use_cache disabled

Answer + AI explanation with Pro

6. Which statement is correct?

Mid
  1. A.Sub-dependency — a dependency that itself declares Depends on another, forming a resolved chain of providers
  2. B.Sub-dependency — the default behavior where a provider called more than once in a single request is executed only once and its result reused
  3. C.Sub-dependency — the marker that declares a callable whose result the framework resolves and injects as a handler argument
  4. D.Sub-dependency — the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result

Answer + AI explanation with Pro

7. What is Per-request dependency caching?

Mid
  1. A.the default behavior where a provider called more than once in a single request is executed only once and its result reused
  2. B.a dependency that itself declares Depends on another, forming a resolved chain of providers
  3. C.the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result
  4. D.a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session

Answer + AI explanation with Pro

8. Which term means: "the default behavior where a provider called more than once in a single request is executed only once and its result reused"?

Mid
  1. A.Path operation dependencies list
  2. B.Sub-dependency
  3. C.Yield dependency
  4. D.Per-request dependency caching

Answer + AI explanation with Pro

9. Which statement is correct?

Mid
  1. A.Per-request dependency caching — the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value
  2. B.Per-request dependency caching — the marker that declares a callable whose result the framework resolves and injects as a handler argument
  3. 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
  4. D.Per-request dependency caching — a dependency that itself declares Depends on another, forming a resolved chain of providers

Answer + AI explanation with Pro

10. What is Yield dependency?

Senior
  1. A.the default behavior where a provider called more than once in a single request is executed only once and its result reused
  2. B.a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session
  3. C.the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value
  4. D.a dependency that itself declares Depends on another, forming a resolved chain of providers

Answer + AI explanation with Pro

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"?

Senior
  1. A.Yield dependency
  2. B.Per-request dependency caching
  3. C.Sub-dependency
  4. D.use_cache disabled

Answer + AI explanation with Pro

12. Which statement is correct?

Senior
  1. A.Yield dependency — the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value
  2. B.Yield dependency — a dependency that itself declares Depends on another, forming a resolved chain of providers
  3. 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
  4. 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

Answer + AI explanation with Pro

13. What is Path operation dependencies list?

Mid
  1. A.the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value
  2. B.a dependency that itself declares Depends on another, forming a resolved chain of providers
  3. C.the default behavior where a provider called more than once in a single request is executed only once and its result reused
  4. D.a provider written as a generator that yields a value and runs teardown code after the response, ideal for closing a database session

Answer + AI explanation with Pro

14. Which term means: "the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value"?

Mid
  1. A.Path operation dependencies list
  2. B.Depends
  3. C.use_cache disabled
  4. D.Per-request dependency caching

Answer + AI explanation with Pro

15. Which statement is correct?

Mid
  1. A.Path operation dependencies list — the marker that declares a callable whose result the framework resolves and injects as a handler argument
  2. B.Path operation dependencies list — the decorator argument that runs providers for their side effects, such as auth checks, without injecting their return value
  3. 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
  4. 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

Answer + AI explanation with Pro

16. What is use_cache disabled?

Senior
  1. A.the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result
  2. B.a dependency that itself declares Depends on another, forming a resolved chain of providers
  3. C.the default behavior where a provider called more than once in a single request is executed only once and its result reused
  4. D.the marker that declares a callable whose result the framework resolves and injects as a handler argument

Answer + AI explanation with Pro

17. Which term means: "the option set to False on Depends to force a provider to re-run rather than reuse its cached per-request result"?

Senior
  1. A.Sub-dependency
  2. B.use_cache disabled
  3. C.Per-request dependency caching
  4. D.Depends

Answer + AI explanation with Pro

18. Which statement is correct?

Senior
  1. 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
  2. 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
  3. C.use_cache disabled — a dependency that itself declares Depends on another, forming a resolved chain of providers
  4. D.use_cache disabled — the marker that declares a callable whose result the framework resolves and injects as a handler argument

Answer + AI explanation with Pro

Free to start

Start with a free readiness check

Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Dependency Injection question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers