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 376–400 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
What are the key principles of REST?

Short answer: Statelessness → Each request is independent; the server doesn’t store client state. Explain a bit more Client-Server Architecture → Separation of concerns between client UI and server logic. Uniform Interfa…

REST API Read answer
Mid PDF
Client stores token (localStorage, cookies). Client sends token in Authorization header:?

Short answer: uthorization: Bearer <token> Real-world example (ShopNest) ShopNest mobile app sends a JWT Bearer token. The API validates it and uses the user id from claims to load that user’s cart only. Say this i…

REST API Read answer
Mid PDF
Client stores token (localStorage, cookies).?

Short answer: Client sends token in Authorization header: Authorization: Bearer <token> Real-world example (ShopNest) ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in…

REST API Read answer
Mid PDF
How does REST differ from SOAP?

Short answer: REST → Lightweight, uses HTTP, usually JSON, easy to use, stateless. SOAP → Protocol-based, uses XML, more complex, built-in security & transactions. REST is more flexible and widely used for web and mo…

REST API Read answer
Mid PDF
Configure web.config (generated automatically) to forward requests to Kestrel. web.config Example: <aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" /> ✅ IIS acts as a reverse proxy, Kestrel handles HTTP requests. Follow : 2⃣ How to Deploy to Docker?

Short answer: Docker allows running ASP.NET Core apps in containers, portable across environments. Dockerfile Example: # Build stage FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY *.csproj ./ RUN dotnet…

Mid PDF
User secrets (in Development) These are merged in order — later values override earlier ones. 🧱 2. What are configuration providers?

Short answer: Configuration providers are components that load configuration data from various sources. Explain a bit more Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In…

Mid PDF
Exception (special case — when an error occurs) Tip: Filters with a lower Order value run first. Example: Follow : [MyActionFilter(Order = 1)] [MyLoggingFilter(Order = 2)] ⚒ 14. How do you create a custom action filter?

Short answer: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($&quot;Action: {context.ActionDescriptor.DisplayName}&quot;); Us…

Mid PDF
Hangfire or Quartz.NET for Background Jobs Hangfire Example: app.UseHangfireDashboard(); RecurringJob.AddOrUpdate(() => Console.WriteLine("Recurring job"), Cron.Daily); Quartz.NET: Supports cron-like scheduling and clustered execution.

Short answer: Hangfire or Quartz.NET for Background Jobs Hangfire Example code app.UseHangfireDashboard(); RecurringJob.AddOrUpdate(() =&gt; Console.WriteLine(&quot;Recurring job&quot;), Cron.Daily); Quartz.NET: Supports…

Mid PDF
How to Test Minimal APIs?

Short answer: How to Test Minimal APIs? Answer: Minimal APIs are tested using WebApplicationFactory or TestServer. Example: var factory = new WebApplicationFactory&lt;Program&gt;(); Example code var client = factory.Crea…

Mid PDF
What does it mean for an API to be stateless?

Short answer: Stateless means the server does not store client session data. Each request must contain all the necessary information (like authentication tokens). This makes APIs scalable and reliable. Real-world example…

REST API Read answer
Mid PDF
Health Checking in ASP.NET Core builder.Services.AddHealthChecks() .AddSqlServer(connectionString) .AddCheck<CustomHealthCheck>("CustomCheck"); app.MapHealthChecks("/health"); Custom Health Check Example: public class CustomHealthCheck : IHealthCheck { public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken token) => Task.FromResult(HealthCheckResult.Healthy("Everything OK")); }

Short answer: Health Checking in ASP.NET Core builder.Services.AddHealthChecks() .AddSqlServer(connectionString) .AddCheck&lt;CustomHealthCheck&gt;(&quot;CustomCheck&quot;); app.MapHealthChecks(&quot;/health&quot;); Cust…

Mid PDF
How to Use Serilog or NLog?

Short answer: How to Use Serilog or NLog? Serilog Example (Program.cs): builder.Host.UseSerilog((ctx, lc) =&gt; lc .WriteTo.Console() .WriteTo.File(&quot;logs/log-.txt&quot;, rollingInterval: RollingInterval.Day) ); NLog…

Mid PDF
What Frameworks Are Commonly Used?

Short answer: What Frameworks Are Commonly Used? Answer: xUnit – Popular, lightweight, supports parallel testing. NUnit – Rich assertion library. MSTest – Microsoft-supported, integrated in Visual Studio. Most modern ASP…

Mid PDF
Profile queries with ToQueryString(). Example: var data = _context.Products.AsNoTracking().Select(p => new { p.Name, p.Price }).ToList(); ⚡ 18. How to use compiled queries?

Short answer: Compiled queries improve performance by caching query translation. Example code private static readonly Func&lt;AppDbContext, decimal, IEnumerable&lt;Product&gt;&gt; _getExpensiveProducts = EF.CompileQuery(…

Mid PDF
What are the benefits of using REST APIs?

Short answer: Platform-independent (works across web, mobile, IoT). Simple, flexible, and scalable. Uses existing HTTP infrastructure. Lightweight (JSON/XML). Supports caching for better performance. Real-world example (…

REST API Read answer
Mid PDF
Rate Limiting Middleware in .NET 8 builder.Services.AddRateLimiter(options => { options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext => RateLimitPartition.GetFixedWindowLimiter(httpContext.Connection.Remo teIpAddress?

Short answer: Rate Limiting Middleware in .NET 8 builder.Services.AddRateLimiter(options =&gt; { options.GlobalLimiter = PartitionedRateLimiter.Create&lt;HttpContext, string&gt;(httpContext =&gt; RateLimitPartition.GetFi…

Mid PDF
How to Enable Application Insights?

Short answer: How to Enable Application Insights? Answer: Application Insights provides monitoring, telemetry, and tracing. Setup: builder.Services.AddApplicationInsightsTelemetry(builder.Configurati on[&quot;APPINSIGHTS…

Mid PDF
How to Use Moq for Mocking Dependencies?

Short answer: How to Use Moq for Mocking Dependencies? Answer: Moq creates fake implementations of interfaces to control behavior during tests. Example: var mockRepo = new Mock&lt;IProductRepository&gt;(); mockRepo.Setup…

Mid PDF
What are the advantages of REST over SOAP or XML-RPC?

Short answer: Easier to learn &amp; implement. Supports multiple formats (JSON, XML, plain text). Faster (less overhead). Works seamlessly with modern web &amp; mobile apps. Better performance due to caching &amp; statel…

REST API Read answer
Mid PDF
Can you explain RESTful web services with an example?

Short answer: Suppose we have a User Service API: GET /users → Get all users GET /users/1 → Get user with ID=1 POST /users → Create a new user PUT /users/1 → Update user with ID=1 DELETE /users/1 → Delete user with ID=1…

REST API Read answer
Mid PDF
Explain the concept of "HATEOAS" in REST.

Short answer: HATEOAS (Hypermedia As The Engine Of Application State) means responses contain links to related actions/resources. 👉 Example code { &quot;id&quot;: 1, &quot;name&quot;: &quot;John&quot;, &quot;links&quot;…

REST API Read answer
Mid PDF
How do REST APIs handle authentication and authorization?

Short answer: Common methods: API Keys → Simple tokens. Basic Auth → Username &amp; password (not secure without HTTPS). OAuth 2.0 / OpenID Connect → Standard protocols for secure access. JWT (JSON Web Tokens) → Widely u…

REST API Read answer
Mid PDF
Explain how the POST method differs from GET.

Short answer: GET → Used to retrieve data, should not modify server state, and can be cached/bookmarked. POST → Used to create new resources or submit data. It modifies server state, is not idempotent, and cannot be cach…

REST API Read answer
Mid PDF
What should be the response for an HTTP DELETE request?

Short answer: 200 OK → If the resource was successfully deleted and a response body is returned. 204 No Content → If the resource was deleted but no body is needed. 404 Not Found → If the resource does not exist. Real-wo…

REST API Read answer
Mid PDF
Why is the HTTP GET method considered safe and idempotent?

Short answer: Safe → Because it only retrieves data without modifying server state. Idempotent → Multiple GET requests have the same result; no side effects occur. Real-world example (ShopNest) Creating an order is POST…

REST API Read answer

ASP.NET Web API ASP.NET Core Web API Tutorial · REST API

Short answer: Statelessness → Each request is independent; the server doesn’t store client state.

Explain a bit more

Client-Server Architecture → Separation of concerns between client UI and server logic. Uniform Interface → Standard HTTP methods and URIs. Cacheable → Responses can be cached to improve performance. Layered System → APIs can use intermediaries (like load balancers, proxies). Resource-based → Everything is treated as a resource (like users, orders, products).

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: uthorization: Bearer <token>

Real-world example (ShopNest)

ShopNest mobile app sends a JWT Bearer token. The API validates it and uses the user id from claims to load that user’s cart only.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: Client sends token in Authorization header: Authorization: Bearer <token>

Real-world example (ShopNest)

ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: REST → Lightweight, uses HTTP, usually JSON, easy to use, stateless. SOAP → Protocol-based, uses XML, more complex, built-in security & transactions. REST is more flexible and widely used for web and mobile apps.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Docker allows running ASP.NET Core apps in containers, portable across environments. Dockerfile Example: # Build stage FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY *.csproj ./ RUN dotnet restore COPY .

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Configuration providers are components that load configuration data from various sources.

Explain a bit more

Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In-memory collections Azure Key Vault User Secrets (for local dev) Custom providers (you can build your own) builder.Configuration .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddCommandLine(args); Each provider plugs into the same configuration system, so you can access everything via IConfiguration. Configuration providers are components that load configuration data from various sources. Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In-memory collections Azure Key Vault User Secrets (for local dev) Custom providers (you can build your own)

Example code

builder.Configuration .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddCommandLine(args); Each provider plugs into the same configuration system, so you can access everything via IConfiguration. Configuration providers are components that load configuration data from various sources. Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In-memory collections Azure Key Vault User Secrets (for local dev) Custom providers (you can build your own) Example: builder.Configuration .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddCommandLine(args); Each provider plugs into the same configuration system, so you can access everything via IConfiguration. Configuration providers are components that load configuration data from various sources. Built-in Providers: JSON files (appsettings.json) Environment variables Command-line arguments In-memory collections Azure Key Vault User Secrets (for local dev) Custom providers (you can build your own) Example: builder.Configuration .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .AddCommandLine(args); Each provider plugs into the same configuration system, so you can access everything via IConfiguration. 🔐 3. How do you manage secrets in development? In development, never store passwords, API keys, or connection strings in code or ppsettings.json. Use User Secrets — a safe way to store secrets outside the project tree. 🧰 4. What is User Secrets in ASP.NET Core? User Secrets are a local, developer-only configuration storage that keeps sensitive data out of source control. Setup: Enable secrets: dotnet user-secrets init

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15.

Explain a bit more

How do you pass data from controller to view?

Example code

public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use: public class LogActionFilter : ActionFilterAttribute public override void OnActionExecuting(ActionExecutingContext context) Console.WriteLine($"Action: {context.ActionDescriptor.DisplayName}"); Use it: [LogActionFilter] public IActionResult Index() => View(); 📤 15. How do you pass data from controller to view? You can use:

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Hangfire or Quartz.NET for Background Jobs Hangfire

Example code

app.UseHangfireDashboard(); RecurringJob.AddOrUpdate(() => Console.WriteLine("Recurring job"), Cron.Daily); Quartz.NET: Supports cron-like scheduling and clustered execution.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: How to Test Minimal APIs? Answer: Minimal APIs are tested using WebApplicationFactory or TestServer. Example: var factory = new WebApplicationFactory<Program>();

Example code

var client = factory.CreateClient();
var response = await client.GetAsync("/products");
var products = await response.Content.ReadFromJsonAsync<List<Product>>(); Assert.NotEmpty(products);

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: Stateless means the server does not store client session data. Each request must contain all the necessary information (like authentication tokens). This makes APIs scalable and reliable.

Real-world example (ShopNest)

ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Health Checking in ASP.NET Core builder.Services.AddHealthChecks() .AddSqlServer(connectionString) .AddCheck<CustomHealthCheck>("CustomCheck"); app.MapHealthChecks("/health"); Custom Health Check Example: public class CustomHealthCheck : IHealthCheck

Example code

{
public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken token) => Task.FromResult(HealthCheckResult.Healthy("Everything OK")); }

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: How to Use Serilog or NLog? Serilog Example (Program.cs): builder.Host.UseSerilog((ctx, lc) => lc .WriteTo.Console() .WriteTo.File("logs/log-.txt", rollingInterval: RollingInterval.Day) ); NLog

Example code

Install NLog.Extensions.Logging package Add NLog.config file Configure in Program.cs: builder.Logging.ClearProviders(); builder.Logging.SetMinimumLevel(LogLevel.Information); builder.Host.UseNLog(); ✅ Both support structured logging, sinks, filtering, and rolling files.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: What Frameworks Are Commonly Used? Answer: xUnit – Popular, lightweight, supports parallel testing. NUnit – Rich assertion library. MSTest – Microsoft-supported, integrated in Visual Studio. Most modern ASP.NET Core projects use xUnit + Moq.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Compiled queries improve performance by caching query translation.

Example code

private static readonly Func<AppDbContext, decimal, IEnumerable<Product>> _getExpensiveProducts = EF.CompileQuery((AppDbContext ctx, decimal price) => ctx.Products.Where(p => p.Price > price)); var result = _getExpensiveProducts(_context, 1000); 🔍 19. Pool Size=5; uthentication & Authorization

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: Platform-independent (works across web, mobile, IoT). Simple, flexible, and scalable. Uses existing HTTP infrastructure. Lightweight (JSON/XML). Supports caching for better performance.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: Rate Limiting Middleware in .NET 8 builder.Services.AddRateLimiter(options => { options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext => RateLimitPartition.GetFixedWindowLimiter(httpContext.Connection.Remo teIpAddress?.ToString()!, _ => new FixedWindowRateLimiterOptions { PermitLimit = 10, Window = TimeSpan.FromMinutes(1), QueueLimit = 2 })); }); app.UseRateLimiter(); ✅ Helps protect…

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: How to Enable Application Insights? Answer: Application Insights provides monitoring, telemetry, and tracing. Setup: builder.Services.AddApplicationInsightsTelemetry(builder.Configurati on["APPINSIGHTS_INSTRUMENTATIONKEY"]); Features: Track requests, exceptions, and dependencies Live metrics and dashboards Custom events and telemetry

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 MVC ASP.NET Core MVC Tutorial · MVC

Short answer: How to Use Moq for Mocking Dependencies? Answer: Moq creates fake implementations of interfaces to control behavior during tests. Example: var mockRepo = new Mock<IProductRepository>(); mockRepo.Setup(x => x.GetAll()).Returns(new List<Product> { new Product { Id = 1, Name = "Laptop" } });

Example code

var service = new ProductService(mockRepo.Object);
var products = service.GetAll(); Assert.Single(products); ✅ Use .Setup(), .Verify(), and .Returns() to simulate behavior.

Real-world example (ShopNest)

ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: Easier to learn & implement. Supports multiple formats (JSON, XML, plain text). Faster (less overhead). Works seamlessly with modern web & mobile apps. Better performance due to caching & statelessness.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: Suppose we have a User Service API: GET /users → Get all users GET /users/1 → Get user with ID=1 POST /users → Create a new user PUT /users/1 → Update user with ID=1 DELETE /users/1 → Delete user with ID=1 This shows how CRUD operations map directly to HTTP methods.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: HATEOAS (Hypermedia As The Engine Of Application State) means responses contain links to related actions/resources. 👉

Example code

{ "id": 1, "name": "John", "links": [ { "rel": "self", "href": "/users/1" }, { "rel": "orders", "href": "/users/1/orders" } } This helps clients navigate APIs dynamically.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: Common methods: API Keys → Simple tokens. Basic Auth → Username & password (not secure without HTTPS). OAuth 2.0 / OpenID Connect → Standard protocols for secure access. JWT (JSON Web Tokens) → Widely used for stateless authentication.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: GET → Used to retrieve data, should not modify server state, and can be cached/bookmarked. POST → Used to create new resources or submit data. It modifies server state, is not idempotent, and cannot be cached.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: 200 OK → If the resource was successfully deleted and a response body is returned. 204 No Content → If the resource was deleted but no body is needed. 404 Not Found → If the resource does not exist.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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 Web API ASP.NET Core Web API Tutorial · REST API

Short answer: Safe → Because it only retrieves data without modifying server state. Idempotent → Multiple GET requests have the same result; no side effects occur.

Real-world example (ShopNest)

Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.

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