Bird
0
0

What will happen if a dependency injection container tries to build a service with a missing dependency registration?

medium📝 Analysis Q5 of 15
LLD - Advanced LLD Concepts
What will happen if a dependency injection container tries to build a service with a missing dependency registration?
AIt creates the service with a null dependency
BIt automatically creates a default instance
CIt ignores the missing dependency and continues
DIt throws an error indicating the missing dependency
Step-by-Step Solution
Solution:
  1. Step 1: Understand container behavior on missing dependencies

    Containers usually require all dependencies to be registered; missing ones cause errors.
  2. Step 2: Match behavior to options

    It throws an error indicating the missing dependency correctly describes the error thrown. Others describe unsafe or incorrect behaviors.
  3. Final Answer:

    It throws an error indicating the missing dependency -> Option D
  4. Quick Check:

    Missing dependency handling = Throws error [OK]
Quick Trick: Missing dependencies cause container errors [OK]
Common Mistakes:
  • Assuming container silently ignores missing dependencies
  • Thinking container creates null or default instances automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes