🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Programs run faster
  2. B.It removes the need for classes
  3. C.A fake or different implementation can be passed in, for example in unit tests
  4. 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 →