C# Interview

SOLID, DI, Testing & Practical C#

C# interview questions covering solid, di, testing & practical c#.

10 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

10 Results
91
Mid-LevelIntermediate

What are the SOLID principles?

SOLID is a group of five object-oriented design principles intended to improve maintainability, flexibility, and testability.

92
Mid-LevelIntermediate

What is the Single Responsibility Principle?

The Single Responsibility Principle states that a class or module should have one focused responsibility or one primary reason to change.

93
Mid-LevelIntermediate

What is dependency injection in C# and ASP.NET Core?

Dependency Injection (DI) is a design technique where a class receives its dependencies from outside rather than creating them internally.

94
Mid-LevelIntermediate

What is the difference between Transient, Scoped, and Singleton lifetimes?

ASP.NET Core's DI container supports several service lifetimes.

95
Mid-LevelIntermediate

What is loose coupling, and why is it important?

Loose coupling means components depend as little as practical on concrete implementation details.

96
Mid-LevelIntermediate

What is unit testing in C#?

Unit testing verifies a small unit of behavior, such as a method or service, in isolation from unrelated infrastructure.

97
Mid-LevelIntermediate

What is mocking in unit testing?

Mocking replaces a dependency with a controllable test double so that the unit under test can be tested without calling the real external component.

98
Mid-LevelIntermediate

What is the difference between unit testing and integration testing?

Unit testing focuses on a small piece of logic and normally isolates external dependencies. It is fast and useful for verifying business rules and edge cases.

99
Mid-LevelIntermediate

What are common C# performance best practices?

Performance optimization should be driven by measurement rather than assumptions. Profiling, tracing, metrics, database execution plans, and benchmarks help identify actual bottlenecks.

100
Mid-LevelIntermediate

How would you design clean and maintainable C# code for a production application?

Clean production C# code should have clear responsibilities, meaningful names, appropriate abstractions, predictable error handling, and strong testability.