Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 1001–1025 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
What are the main differences between Entity Framework (EF6) and EF Core?

Short answer: Feature EF6 EF Core Platform .NET Framework only Cross-platform (.NET Core) Performance Slower Faster and more optimized LINQ support Limited Enhanced Change tracking Basic More efficient Migrations Availab…

EF Core Read answer
Mid PDF
What are entities and how do they map to tables?

Short answer: column. EF Core uses conventions or Fluent API to configure the mappings. Real-world example (ShopNest) ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() ca…

EF Core Read answer
Mid PDF
What are entities and how do they map to tables?

Short answer: Entities are .NET classes that represent database tables. Each property in the entity maps to a column. EF Core uses conventions or Fluent API to configure the mappings. Real-world example (ShopNest) ShopNe…

EF Core Read answer
Mid PDF
How do abstractions help in DIP?

Short answer: Abstractions (e.g., interfaces or abstract classes): Decouple components so changes in one don’t ripple through others Enable substitution of different implementations easily Allow for easier unit testing w…

SOLID Read answer
Mid PDF
Can you explain DIP with an example in C#?

Short answer: ❌ Without DIP (Tightly Coupled): public class FileLogger Example code { public void Log(string message) => Console.WriteLine("File log: " + message); } public class OrderService { private reado…

SOLID Read answer
Mid PDF
What are the benefits of following DIP?

Short answer: ✅ Key Benefits: Decouples components — changes in low-level modules won’t affect high-level ones Improves testability — you can easily inject mocks/stubs Enhances flexibility — swap implementations without…

SOLID Read answer
Mid PDF
Can you give an example where you combined Repository and Unit of Work patterns?

Short answer: The Unit of Work coordinates multiple Repositories and commits changes in a single transaction. For example: public interface IUnitOfWork : IDisposable Example code { IProductRepository Products { get; } IO…

SOLID Read answer
Mid PDF
How do you test classes that use Singleton or static instances?

Short answer: Testing singletons/statics is tricky due to global state. Best practices include: Refactor to use interfaces and DI instead of static/singletons. Wrap static calls behind interfaces so you can mock them. Us…

SOLID Read answer
Mid PDF
How do you apply Strategy pattern to implement multiple payment methods?

Short answer: Define a common interface, e.g., IPaymentStrategy with a method Pay(). Implement concrete strategies for each payment method (CreditCard, PayPal, etc.). Use a context class to invoke the selected strategy a…

SOLID Read answer
Mid PDF
Can you explain how DI containers resolve dependencies at runtime?

Short answer: DI containers use reflection to inspect constructors of requested services, resolve dependencies recursively from their registrations, apply lifecycle scopes (Singleton, Scoped, Transient), and build the fu…

SOLID Read answer
Mid PDF
How do you implement DI in ASP.NET Core MVC?

Short answer: ASP.NET Core MVC has built-in support for Dependency Injection. Explain a bit more Register services in Startup.cs within ConfigureServices method using IServiceCollection: public void ConfigureServices(ISe…

SOLID Read answer
Mid PDF
How do you configure EF Core Repository and Unit of Work in .NET Core?

Short answer: Register DbContext with DI in Startup.cs: services.AddDbContext<AppDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConne ction"))); Implement Reposito…

SOLID Read answer
Mid PDF
How do you mock dependencies in unit tests using DI?

Short answer: Use mocking libraries like Moq, NSubstitute, or FakeItEasy. Create mocks of interfaces and inject them into the class under test: var mockRepo = new Mock<IProductRepository>(); mockRepo.Setup(repo =&g…

SOLID Read answer
Mid PDF
How do you apply the Strategy pattern to select different caching strategies in .NET?

Short answer: Define a caching interface: public interface ICacheStrategy { void Cache(string key, object value); object Retrieve(string key); } Implement strategies like MemoryCacheStrategy, DistributedCacheStrategy. Us…

SOLID Read answer
Mid PDF
Can you explain the difference between Abstract Factory and Builder patterns with examples?

Short answer: Abstract Factory: Provides an interface for creating families of related objects without specifying concrete classes. Example code Creating UI components for different OS (Windows, Mac). Builder: Focuses on…

SOLID Read answer
Mid PDF
How do you avoid God classes in .NET applications?

Short answer: Apply Single Responsibility Principle (SRP) by splitting responsibilities into smaller classes. Use composition instead of inheritance to delegate behavior. Extract business logic into services or helpers.…

SOLID Read answer
Mid PDF
Have you ever faced issues with Singleton pattern in multi-threaded?

Short answer: Applications? Yes. In one project, a singleton was used without thread safety, causing race conditions when accessed concurrently. This led to inconsistent state and application crashes. We resolved it by i…

SOLID Read answer
Mid PDF
Have you ever faced issues with Singleton pattern in multi-threaded applications?

Short answer: Yes. In one project, a singleton was used without thread safety, causing race conditions when accessed concurrently. This led to inconsistent state and application crashes. We resolved it by implementing th…

SOLID Read answer
Mid PDF
How do you balance between over-engineering and following design principles?

Short answer: I prioritize YAGNI (You Aren’t Gonna Need It) to avoid over-engineering. Explain a bit more SOLID principles guide design for flexibility and maintainability, but I apply them pragmatically: start with simp…

SOLID Read answer
Mid PDF
How does the Decorator pattern differ from the Proxy pattern?

Short answer: Decorator adds additional responsibilities to objects dynamically without altering their interface. It wraps the original object to extend behavior. Proxy controls access to an object, possibly adding lazy…

SOLID Read answer
Mid PDF
What are anti-patterns related to DI and Singleton?

Short answer: Service Locator anti-pattern: Hides dependencies instead of injecting them explicitly. Overusing Singleton: Leads to hidden global state and testing difficulties. Improper Singleton thread safety: Causes ra…

SOLID Read answer
Mid PDF
Can you explain the Template Method pattern?

Short answer: Template Method defines the skeleton of an algorithm in a base class, deferring some steps to subclasses. It allows subclasses to redefine parts of the algorithm without changing its structure. It supports…

SOLID Read answer
Mid PDF
How do you avoid tight coupling in large .NET projects?

Short answer: Use interfaces and abstractions (DIP). Apply Dependency Injection. Modularize code into bounded contexts or separate projects. Use events or messaging for decoupled communication. Avoid static state and glo…

SOLID Read answer
Mid PDF
How does the Command pattern work?

Short answer: Encapsulates a request as an object with methods to execute and possibly undo the operation. The invoker calls commands without knowing the action details, supporting decoupling and flexible request handlin…

SOLID Read answer
Mid PDF
Can you explain the Builder pattern with a real-world .NET example?

Short answer: Builder separates complex object construction from its representation. For example, building an HttpRequest with optional headers, query params, and body: public class HttpRequestBuilder Example code { priv…

SOLID Read answer

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Feature EF6 EF Core Platform .NET Framework only Cross-platform (.NET Core) Performance Slower Faster and more optimized LINQ support Limited Enhanced Change tracking Basic More efficient Migrations Available Improved and CLI-friendly Extensibility Limited Highly extensible

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: column. EF Core uses conventions or Fluent API to configure the mappings.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Entities are .NET classes that represent database tables. Each property in the entity maps to a column. EF Core uses conventions or Fluent API to configure the mappings.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Abstractions (e.g., interfaces or abstract classes): Decouple components so changes in one don’t ripple through others Enable substitution of different implementations easily Allow for easier unit testing with mocks/stubs Promote extensibility and maintainability Serve as contracts that both high- and low-level modules depend on

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: ❌ Without DIP (Tightly Coupled): public class FileLogger

Example code

{
public void Log(string message) => Console.WriteLine("File log: " + message); }
public class OrderService
{
private readonly FileLogger _logger = new FileLogger();
public void ProcessOrder()
{ // Logic _logger.Log("Order processed."); }
} OrderService is tightly coupled to FileLogger. ✅ With DIP (Loosely Coupled via Abstraction): public interface ILogger
{ void Log(string message); }
public class FileLogger : ILogger
{
public void Log(string message) => Console.WriteLine("File log: " + message); }
public class OrderService
{
private readonly ILogger _logger;
public OrderService(ILogger logger)
{
_logger = logger;
}
public void ProcessOrder()
{ // Logic _logger.Log("Order processed."); }
} Now OrderService depends on the abstraction (ILogger), not the concrete FileLogger. You can easily substitute with DatabaseLogger, ConsoleLogger, or a mock in tests.

Real-world example (ShopNest)

Open/Closed in ShopNest: add a new payment method by adding a class, not by editing a giant switch in CheckoutService.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: ✅ Key Benefits: Decouples components — changes in low-level modules won’t affect high-level ones Improves testability — you can easily inject mocks/stubs Enhances flexibility — swap implementations without touching core logic Promotes reuse — abstractions can be used across different modules Supports SOLID architecture — especially when combined with DI and IoC containers Advanced & Scenario-Based Questions

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: The Unit of Work coordinates multiple Repositories and commits changes in a single transaction. For example: public interface IUnitOfWork : IDisposable

Example code

{ IProductRepository Products { get; } IOrderRepository Orders { get; } int Complete();
}
public class UnitOfWork : IUnitOfWork
{
private readonly DbContext _context;
public IProductRepository Products { get; }
public IOrderRepository Orders { get; }
public UnitOfWork(DbContext context)
{
_context = context;
Products = new ProductRepository(_context);
Orders = new OrderRepository(_context);
}
public int Complete() => _context.SaveChanges();
public void Dispose() => _context.Dispose();
} This ensures atomic commits across repositories.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Testing singletons/statics is tricky due to global state. Best practices include: Refactor to use interfaces and DI instead of static/singletons. Wrap static calls behind interfaces so you can mock them. Use specialized mocking tools (e.g., Microsoft Fakes) if refactoring isn't possible. Avoid static state to improve testability.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Define a common interface, e.g., IPaymentStrategy with a method Pay(). Implement concrete strategies for each payment method (CreditCard, PayPal, etc.). Use a context class to invoke the selected strategy at runtime, enabling easy extension without modifying existing code.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: DI containers use reflection to inspect constructors of requested services, resolve dependencies recursively from their registrations, apply lifecycle scopes (Singleton, Scoped, Transient), and build the full object graph to return fully constructed instances.

Real-world example (ShopNest)

Patterns in ShopNest should solve a real pain (swappable payments, test seams)—not be added for decoration.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: ASP.NET Core MVC has built-in support for Dependency Injection.

Explain a bit more

Register services in Startup.cs within ConfigureServices method using IServiceCollection: public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.AddScoped<IProductService, ProductService>(); // Example } Inject dependencies via constructor injection in controllers or services: public class HomeController : Controller

Example code

{
private readonly IProductService _productService;
public HomeController(IProductService productService)
{
_productService = productService;
}
public IActionResult Index()
{
var products = _productService.GetAll();
return View(products);
}
} The framework resolves and injects dependencies automatically.

Real-world example (ShopNest)

Patterns in ShopNest should solve a real pain (swappable payments, test seams)—not be added for decoration.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Register DbContext with DI in Startup.cs: services.AddDbContext<AppDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConne ction"))); Implement Repositories for entities injecting AppDbContext. Implement Unit of Work which holds multiple repositories and calls SaveChanges() on the DbContext: public interface IUnitOfWork : IDisposable

Example code

{ IProductRepository Products { get; } int Complete();
}
public class UnitOfWork : IUnitOfWork
{
private readonly AppDbContext _context;
public IProductRepository Products { get; private set; }
public UnitOfWork(AppDbContext context)
{
_context = context;
Products = new ProductRepository(_context);
}
public int Complete() => _context.SaveChanges();
public void Dispose() => _context.Dispose();
} Register UnitOfWork in DI container as Scoped.

Real-world example (ShopNest)

ShopNest payment fees use Strategy: IFeeCalculator with UPI/Card implementations chosen at runtime.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Use mocking libraries like Moq, NSubstitute, or FakeItEasy. Create mocks of interfaces and inject them into the class under test: var mockRepo = new Mock<IProductRepository>(); mockRepo.Setup(repo => repo.GetAll()).Returns(new List<Product> { ... }); var service = new ProductService(mockRepo.Object); // Act & Assert This allows testing in isolation without hitting real databases or external services.

Real-world example (ShopNest)

Patterns in ShopNest should solve a real pain (swappable payments, test seams)—not be added for decoration.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Define a caching interface: public interface ICacheStrategy { void Cache(string key, object value); object Retrieve(string key); } Implement strategies like MemoryCacheStrategy, DistributedCacheStrategy. Use DI or factory to inject the chosen strategy at runtime: public class CacheContext

Example code

{
private readonly ICacheStrategy _cacheStrategy;
public CacheContext(ICacheStrategy cacheStrategy)
{
_cacheStrategy = cacheStrategy;
}
public void Cache(string key, object value) => _cacheStrategy.Cache(key, value); } This enables switching caching mechanisms without code changes.

Real-world example (ShopNest)

ShopNest payment fees use Strategy: IFeeCalculator with UPI/Card implementations chosen at runtime.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Abstract Factory: Provides an interface for creating families of related objects without specifying concrete classes.

Example code

Creating UI components for different OS (Windows, Mac). Builder: Focuses on step-by-step construction of a complex object, allowing different representations. Example: Building a complex House with various parts (walls, doors, roof). Summary: Abstract Factory is about families of products, Builder is about complex construction process.

Real-world example (ShopNest)

ShopNest payment fees use Strategy: IFeeCalculator with UPI/Card implementations chosen at runtime.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Apply Single Responsibility Principle (SRP) by splitting responsibilities into smaller classes. Use composition instead of inheritance to delegate behavior. Extract business logic into services or helpers. Introduce abstractions to isolate concerns. Continuously refactor large classes and add unit tests.

Real-world example (ShopNest)

Patterns in ShopNest should solve a real pain (swappable payments, test seams)—not be added for decoration.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Applications? Yes. In one project, a singleton was used without thread safety, causing race conditions when accessed concurrently. This led to inconsistent state and application crashes. We resolved it by implementing thread-safe lazy initialization using Lazy<T> in .NET, ensuring the singleton instance was created safely once, even under heavy… parallel…

Real-world example (ShopNest)

ShopNest payment fees use Strategy: IFeeCalculator with UPI/Card implementations chosen at runtime.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Yes. In one project, a singleton was used without thread safety, causing race conditions when accessed concurrently. This led to inconsistent state and application crashes. We resolved it by implementing thread-safe lazy initialization using Lazy<T> in .NET, ensuring the singleton instance was created safely once, even under heavy parallel access.

Real-world example (ShopNest)

ShopNest payment fees use Strategy: IFeeCalculator with UPI/Card implementations chosen at runtime.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: I prioritize YAGNI (You Aren’t Gonna Need It) to avoid over-engineering.

Explain a bit more

SOLID principles guide design for flexibility and maintainability, but I apply them pragmatically: start with simple solutions and refactor as requirements evolve. Writing tests early helps identify pain points justifying additional abstractions. Communication with the team ensures we don’t add complexity prematurely but keep the codebase adaptable.

Real-world example (ShopNest)

Patterns in ShopNest should solve a real pain (swappable payments, test seams)—not be added for decoration.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Decorator adds additional responsibilities to objects dynamically without altering their interface. It wraps the original object to extend behavior. Proxy controls access to an object, possibly adding lazy initialization, access control, or logging, without changing its interface.

Real-world example (ShopNest)

ShopNest payment fees use Strategy: IFeeCalculator with UPI/Card implementations chosen at runtime.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Service Locator anti-pattern: Hides dependencies instead of injecting them explicitly. Overusing Singleton: Leads to hidden global state and testing difficulties. Improper Singleton thread safety: Causes race conditions. Injecting concrete implementations: Violates DIP.

Real-world example (ShopNest)

ShopNest payment fees use Strategy: IFeeCalculator with UPI/Card implementations chosen at runtime.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Template Method defines the skeleton of an algorithm in a base class, deferring some steps to subclasses. It allows subclasses to redefine parts of the algorithm without changing its structure. It supports OCP by enabling extensions through inheritance.

Real-world example (ShopNest)

Patterns in ShopNest should solve a real pain (swappable payments, test seams)—not be added for decoration.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Use interfaces and abstractions (DIP). Apply Dependency Injection. Modularize code into bounded contexts or separate projects. Use events or messaging for decoupled communication. Avoid static state and global variables.

Real-world example (ShopNest)

Patterns in ShopNest should solve a real pain (swappable payments, test seams)—not be added for decoration.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Encapsulates a request as an object with methods to execute and possibly undo the operation. The invoker calls commands without knowing the action details, supporting decoupling and flexible request handling.

Real-world example (ShopNest)

Patterns in ShopNest should solve a real pain (swappable payments, test seams)—not be added for decoration.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Short answer: Builder separates complex object construction from its representation. For example, building an HttpRequest with optional headers, query params, and body: public class HttpRequestBuilder

Example code

{
private HttpRequestMessage _request = new HttpRequestMessage();
public HttpRequestBuilder SetMethod(HttpMethod method)
{
_request.Method = method;
return this;
}
public HttpRequestBuilder AddHeader(string key, string value)
{ _request.Headers.Add(key, value); return this;
}
public HttpRequestMessage Build() => _request;
} Allows building requests step-by-step fluently.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details