W3
Teacher
Explore
Browse by field
Artificial Intelligence
Accounting & Finance
Information Technology
Show all fields
Interview Q&A
All Interview Questions
Beginner
Intermediate
Advanced
Practice
MCQs
Quizzes
Mock Interviews
About
Light
Dark
Auto
Sign in
Get Started
Search interview questions
Search
17 questions for “Dependency Injection & IoC Principles”
Found in 1 field. Select a question to see its full answer.
Matching topics
C#
Dependency
Injection
&
IoC
Principles
10
Information Technology
17 questions in 2 technologies
#
Question
Technology
Topic
Level
1
What is the Inversion of Control (
IoC
) principle, and how does
dependency
injection
relate to it as one specific technique?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Intermediate
2
What is
dependency
injection
, and what problem does it solve compared to a class creating its own dependencies directly?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Beginner
3
How do you register and resolve a service using ASP.NET Core's built-in
dependency
injection
container?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Beginner
4
How would you implement the Factory pattern using
dependency
injection
to resolve a specific implementation at runtime based on a parameter, when the standard container can't decide statically?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Advanced
5
How does constructor
injection
differ from property (setter)
injection
, and why is constructor
injection
generally preferred?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Intermediate
6
What causes a 'captive
dependency
' bug, and how does ASP.NET Core's DI container detect and prevent it?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Advanced
7
How do you correctly and safely resolve a Scoped service from within a Singleton service using IServiceScopeFactory, avoiding the captive
dependency
problem?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Advanced
8
How would you write a custom IServiceProviderFactory or use a third-party container (like Autofac) to enable advanced DI features not supported by the built-in ASP.NET Core container, like property
injection
or convention-based registration?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Advanced
9
What is the difference between Singleton, Scoped, and Transient service lifetimes in ASP.NET Core's DI container?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Intermediate
10
How does the DI container resolve a class with MULTIPLE constructors, and how do you influence which one gets chosen?
C# › Dependency Injection & IoC Principles
C#
Dependency
Injection
&
IoC
Principles
Advanced
Show all 17 questions in Information Technology