← Quiz: SOLID Principles: all 10 questions
Quiz: SOLID Principles · Question 8 of 10
What is the main practical benefit of dependency injection?
What is the main practical benefit of dependency injection?
- A.Programs run faster
- B.It removes the need for classes
- C.A fake or different implementation can be passed in, for example in unit tests
- D.It makes every class a singleton
Answer & explanation
Correct answer: A fake or different implementation can be passed in, for example in unit tests
The object receives its dependency from outside, so tests can pass a fake.
Can you get the rest right without peeking?
Take the timed Quiz: SOLID Principles quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →