C# Mastery Hub
Home
Challenges
Discussion
Lessons
Core Topics
C# Fundamentals
Console Applications
Classes & OOP
Windows Forms
ASP.NET Core
SQL Server
VS & SQL Connection
RDLC Reports
.NET MAUI
Getting Started
Getting Started
Website Development
SEO Guide
Security
Project Workflow
Extra Topics
Cloud & Deployment
AWS Cloud
Deployment
About
Contact
Test Your Knowledge
Razor Pages - Lesson 7: Dependency Injection Quiz
Answer all questions to test your understanding
1
What is Dependency Injection (DI)?
A pattern where objects receive dependencies from an external source
A pattern where objects create their own dependencies
A database pattern
A UI pattern
2
Which service lifetime creates a new instance every time it's requested?
Singleton
Scoped
Transient
PerRequest
3
Which service lifetime creates one instance per HTTP request?
Singleton
Scoped
Transient
PerRequest
4
Which service lifetime creates one instance for the entire application lifetime?
Singleton
Scoped
Transient
PerRequest
5
How do you register a service in ASP.NET Core?
Using builder.Services in Program.cs
Using the [Inject] attribute
Using the Startup.cs file
Using the appsettings.json file
Submit Quiz