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 176–200 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Can filters depend on scoped services?

Short answer: Yes—but avoid heavy operations that run per action. Real-world example (ShopNest) ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading b…

ASP.NET Core Read answer
Mid PDF
Using Options pattern (IOptions, IOptionsSnapshot,?

Short answer: IOptionsMonitor) IOptions<T>: For singleton/config services. IOptionsSnapshot<T>: Scoped; updates per request. IOptionsMonitor<T>: Singleton; can react to config changes. services.Configur…

ASP.NET Core Read answer
Mid PDF
How do you inject settings or configuration into filters?

Short answer: Use IOptions or DI into constructor. Real-world example (ShopNest) A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller. Say this in…

ASP.NET Core Read answer
Mid PDF
When is IHostedService / BackgroundService used and how DI works

Short answer: there Use IHostedService or BackgroundService for tasks that run in the background. Services are injected via constructor. Scoped services must use IServiceScopeFactory. Real-world example (ShopNest) ShopNe…

ASP.NET Core Read answer
Mid PDF
When is an Exception Filter not suitable?

Short answer: When exceptions must be caught outside MVC (e.g., authorization failures). Say this in the interview Define — one clear sentence (the short answer above). Example — relate it to a project like ShopNest or y…

ASP.NET Core Read answer
Mid PDF
Injecting the configuration provider (IConfiguration)?

Short answer: IConfiguration is automatically registered and injected via constructor. public MyService(IConfiguration config) Example code { var key = config["MyKey"]; } Real-world example (ShopNest) A ShopNes…

ASP.NET Core Read answer
Mid PDF
How to secure minimal APIs using endpoint filters?

Short answer: dd custom validation and authorization filters using .AddEndpointFilter(). Real-world example (ShopNest) A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same r…

ASP.NET Core Read answer
Mid PDF
Injecting logging (ILogger<T>)?

Short answer: ASP.NET Core provides structured logging via ILogger&lt;T&gt;. public class MyService Example code { private readonly ILogger&lt;MyService&gt; _logger; public MyService(ILogger&lt;MyService&gt; logger) =&gt…

ASP.NET Core Read answer
Mid PDF
Can a filter transform the action result?

Short answer: Yes—result filters can wrap or modify responses. Real-world example (ShopNest) A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.…

ASP.NET Core Read answer
Mid PDF
Handling circular dependencies?

Short answer: Occurs when two services depend on each other directly or indirectly. 🛠 Fix: Refactor to remove circular reference Use Lazy&lt;T&gt; or factory injection Split responsibilities Real-world example (ShopNest…

ASP.NET Core Read answer
Mid PDF
Provide an example of a profiling filter used in production.?

Short answer: A filter that tracks performance of controller actions: public class ProfilingFilter : IAsyncActionFilter Example code { public async Task OnActionExecutionAsync( ActionExecutingContext context, ActionExecu…

ASP.NET Core Read answer
Mid PDF
How to mock dependencies in unit tests

Short answer: Use a mocking framework like Moq: var mockService = new Mock&lt;IMyService&gt;(); mockService.Setup(s =&gt; s.Get()).Returns(&quot;test&quot;); var controller = new MyController(mockService.Object); Mocking…

ASP.NET Core Read answer
Mid PDF
How routing works in MVC / Razor Pages

Short answer: MVC Routing: Uses attribute routing or conventional routing. Example code endpoints.MapControllerRoute( name: &quot;default&quot;, pattern: &quot;{controller=Home}/{action=Index}/{id?}&quot;); Razor Pages R…

ASP.NET Core Read answer
Mid PDF
How routing works in MVC / Razor Pages ● MVC Routing: ○ Uses attribute routing or conventional routing. Example: endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?

Short answer: }&quot;); Razor Pages Routing: Based on folder structure. URL /Products/Edit maps to /Pages/Products/Edit.cshtml. Real-world example (ShopNest) A ShopNest checkout request flows through middleware, hits a m…

ASP.NET Core Read answer
Mid PDF
What are controllers, actions, views, and view components ● Controller: Handles HTTP requests. ● Action Method: A method in the controller that returns a result (like

Short answer: view or JSON). View: .cshtml file that renders HTML. View Component: Reusable mini-views with logic (like partials but with code-behind). Real-world example (ShopNest) A ShopNest checkout request flows thro…

ASP.NET Core Read answer
Mid PDF
What are controllers, actions, views, and view components

Short answer: Controller: Handles HTTP requests. Action Method: A method in the controller that returns a result (like a view or JSON). View: .cshtml file that renders HTML. View Component: Reusable mini-views with logic…

ASP.NET Core Read answer
Mid PDF
Using Tag Helpers vs HTML Helpers?

Short answer: Tag Helpers: Use HTML-like syntax. Easier to read/maintain. &lt;form asp-controller=&quot;Home&quot; asp-action=&quot;Login&quot;&gt;&lt;/form&gt; HTML Helpers: C# methods used in Razor. @Html.BeginForm(&qu…

ASP.NET Core Read answer
Mid PDF
ViewData, ViewBag, TempData: differences and uses Type Lifetime Dynami c?

Short answer: ta cross requests No Preserved for 1 redirect only Real-world example (ShopNest) ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bu…

ASP.NET Core Read answer
Mid PDF
ViewData, ViewBag, TempData: differences and uses Type Lifetime Dynami c?

Short answer: Purpose ViewDa ta Current request No Pass data to views ViewBa Current request Yes ViewData wrapper (dynamic) TempD ata Across requests No Preserved for 1 redirect only Real-world example (ShopNest) ShopNes…

ASP.NET Core Read answer
Mid PDF
Model Binding in MVC/Razor Pages?

Short answer: Automatically maps form values, query strings, route data to C# model properties. public IActionResult Submit(User user) { ... } Binds complex types and simple types out-of-the-box. Real-world example (Shop…

ASP.NET Core Read answer
Mid PDF
Model Validation using Data Annotations?

Short answer: Decorate model properties: public class User { [Required] [EmailAddress] public string Email { get; set; } } Automatically validated during model binding. Use ModelState.IsValid to check. Example code Decor…

ASP.NET Core Read answer
Mid PDF
Custom Validation (IValidatableObject, Custom Validators)?

Short answer: IValidatableObject: public IEnumerable&lt;ValidationResult&gt; Validate(ValidationContext context) Custom Attribute: public class MyCustomAttribute : ValidationAttribute { Example code public override bool…

ASP.NET Core Read answer
Mid PDF
Layouts, Partial Views, View Components?

Short answer: Layouts: Shared structure (e.g. header, footer) using _Layout.cshtml. Partial Views: Reusable UI snippets (_LoginPartial.cshtml). View Components: Partial views with logic. public class CartViewComponent :…

ASP.NET Core Read answer
Mid PDF
How to pass data from controller to view

Short answer: Via ViewBag / ViewData / Model: return View(model); // Strongly typed ViewBag.Message = &quot;Hello&quot;; ViewData[&quot;Count&quot;] = 5; Example code Via ViewBag / ViewData / Model: return View(model); /…

ASP.NET Core Read answer
Mid PDF
Filters: Action filters, result filters, exception filters?

Short answer: ActionFilter: Runs before/after action method. ResultFilter: Runs before/after view result. ExceptionFilter: Catches unhandled exceptions. Apply globally or via attributes. public class LogActionFilter : IA…

ASP.NET Core Read answer

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Yes—but avoid heavy operations that run per action.

Real-world example (ShopNest)

ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: IOptionsMonitor) IOptions<T>: For singleton/config services. IOptionsSnapshot<T>: Scoped; updates per request. IOptionsMonitor<T>: Singleton; can react to config changes. services.Configure<MySettings>(Configuration.GetSection("MySettings" ));

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Use IOptions or DI into constructor.

Real-world example (ShopNest)

A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: there Use IHostedService or BackgroundService for tasks that run in the background. Services are injected via constructor. Scoped services must use IServiceScopeFactory.

Real-world example (ShopNest)

ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: When exceptions must be caught outside MVC (e.g., authorization failures).

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: IConfiguration is automatically registered and injected via constructor. public MyService(IConfiguration config)

Example code

{
var key = config["MyKey"];
}

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: dd custom validation and authorization filters using .AddEndpointFilter().

Real-world example (ShopNest)

A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: ASP.NET Core provides structured logging via ILogger<T>. public class MyService

Example code

{
private readonly ILogger<MyService> _logger;
public MyService(ILogger<MyService> logger) => _logger = logger;
public void DoSomething() => _logger.LogInformation("Action performed"); }

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Yes—result filters can wrap or modify responses.

Real-world example (ShopNest)

A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Occurs when two services depend on each other directly or indirectly. 🛠 Fix: Refactor to remove circular reference Use Lazy<T> or factory injection Split responsibilities

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: A filter that tracks performance of controller actions: public class ProfilingFilter : IAsyncActionFilter

Example code

{
public async Task OnActionExecutionAsync( ActionExecutingContext context, ActionExecutionDelegate next) {
var sw = Stopwatch.StartNew();
var result = await next(); sw.Stop(); Console.WriteLine($"Action took {sw.ElapsedMilliseconds}ms"); }
}

Real-world example (ShopNest)

A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Use a mocking framework like Moq: var mockService = new Mock<IMyService>(); mockService.Setup(s => s.Get()).Returns("test"); var controller = new MyController(mockService.Object); Mocking helps isolate the unit of work and test behavior independently. MVC & Razor Pages

Example code

Use a mocking framework like Moq: var mockService = new Mock<IMyService>();
mockService.Setup(s => s.Get()).Returns("test");
var controller = new MyController(mockService.Object); Mocking helps isolate the unit of work and test behavior independently. MVC & Razor Pages

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: MVC Routing: Uses attribute routing or conventional routing.

Example code

endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); Razor Pages Routing: Based on folder structure. URL /Products/Edit maps to /Pages/Products/Edit.cshtml.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: }"); Razor Pages Routing: Based on folder structure. URL /Products/Edit maps to /Pages/Products/Edit.cshtml.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: view or JSON). View: .cshtml file that renders HTML. View Component: Reusable mini-views with logic (like partials but with code-behind).

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Controller: Handles HTTP requests. Action Method: A method in the controller that returns a result (like a view or JSON). View: .cshtml file that renders HTML. View Component: Reusable mini-views with logic (like partials but with code-behind).

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Tag Helpers: Use HTML-like syntax. Easier to read/maintain. <form asp-controller="Home" asp-action="Login"></form> HTML Helpers: C# methods used in Razor. @Html.BeginForm("Login", "Home") ✅ Prefer Tag Helpers in modern ASP.NET Core apps.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: ta cross requests No Preserved for 1 redirect only

Real-world example (ShopNest)

ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Purpose ViewDa ta Current request No Pass data to views ViewBa Current request Yes ViewData wrapper (dynamic) TempD ata Across requests No Preserved for 1 redirect only

Real-world example (ShopNest)

ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Automatically maps form values, query strings, route data to C# model properties. public IActionResult Submit(User user) { ... } Binds complex types and simple types out-of-the-box.

Real-world example (ShopNest)

ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Decorate model properties: public class User { [Required] [EmailAddress] public string Email { get; set; } } Automatically validated during model binding. Use ModelState.IsValid to check.

Example code

Decorate model properties: public class User { [Required] [EmailAddress] public string Email { get; set; }
} Automatically validated during model binding. Use ModelState.IsValid to check.

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: IValidatableObject: public IEnumerable<ValidationResult> Validate(ValidationContext context) Custom Attribute: public class MyCustomAttribute : ValidationAttribute {

Example code

public override bool IsValid(object value) { ... }
}

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Layouts: Shared structure (e.g. header, footer) using _Layout.cshtml. Partial Views: Reusable UI snippets (_LoginPartial.cshtml). View Components: Partial views with logic. public class CartViewComponent : ViewComponent {

Example code

public IViewComponentResult Invoke() => View("Cart", model); }

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: Via ViewBag / ViewData / Model: return View(model); // Strongly typed ViewBag.Message = "Hello"; ViewData["Count"] = 5;

Example code

Via ViewBag / ViewData / Model: return View(model); // Strongly typed
ViewBag.Message = "Hello";
ViewData["Count"] = 5;

Real-world example (ShopNest)

A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.

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

ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core

Short answer: ActionFilter: Runs before/after action method. ResultFilter: Runs before/after view result. ExceptionFilter: Catches unhandled exceptions. Apply globally or via attributes. public class LogActionFilter : IActionFilter { ... }

Real-world example (ShopNest)

A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.

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