Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Configure CORS policy on the server. Allow specific origins, headers, and methods. 👉 Example in ASP.NET Core: services.AddCors(options => { options.AddPolicy("MyPolicy", builder => builder.…
Short answer: Idempotent = multiple identical requests have the same effect as one request. Important for reliability and safe retries. HTTP Methods: GET, PUT, DELETE → Idempotent. POST → Not idempotent (creates new reso…
Short answer: 2xx Success → 200 (OK), 201 (Created). 4xx Client Errors → 400 (Bad Request), 401 (Unauthorized), 404 (Not Found). 5xx Server Errors → 500 (Internal Server Error), 503 (Service Unavailable). Error responses…
Short answer: Horizontal scaling → Add more servers/containers. Load balancing across multiple instances. Database optimization (indexes, partitioning, read replicas). Caching at server, client, and CDN levels. Use async…
Short answer: Use a load balancer (NGINX, HAProxy, AWS ELB, Azure Front Door). Distribute traffic across multiple instances to avoid bottlenecks. Support round-robin, least connections, or IP hash strategies. Enable heal…
Short answer: Reduce payload size (use JSON instead of XML, compress responses). Implement pagination for large datasets. Apply caching at multiple levels. Use async I/O (non-blocking calls). Minimize database calls (bat…
Short answer: Client-side caching → Reduces server calls, but may serve stale data. Server-side caching → Faster responses, but increases memory usage. Proxy caching/CDN → Global scalability, but harder cache invalidatio…
Short answer: REST API? Add query parameters: Filtering: /products?category=shoes&brand=nike Sorting: /products?sort=price_asc Searching: /products?search=wireless+headphones Use LINQ/SQL queries in backend. Ensure q…
Short answer: Add query parameters: Filtering: /products?category=shoes&brand=nike Sorting: /products?sort=price_asc Searching: /products?search=wireless+headphones Use LINQ/SQL queries in backend. Ensure query optim…
Short answer: Deploy servers closer to users (geo-distributed hosting). Use CDNs for static content. Apply connection pooling for databases. Reduce number of API calls (batching, GraphQL alternative). Use HTTP/2 or gRPC…
Short answer: Swagger/OpenAPI → Standard for REST API design and documentation. Postman → Can generate collections and documentation automatically. Redoc → Static documentation from OpenAPI specs. RAML → RESTful API Mode…
Short answer: In ASP.NET Core: Use Swashbuckle package to generate Swagger UI from controllers and annotations. Explain a bit more services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = &…
Short answer: Use try-catch blocks in code to catch exceptions. Implement global exception handling middleware in ASP.NET Core: app.UseExceptionHandler(appError => { appError.Run(async context => { Example code con…
Short answer: Indicates the requested resource does not exist. Use when resource ID is invalid or missing. Helps clients handle missing data gracefully. Example in ASP.NET Core: var user = db.Users.Find(id); Example code…
Short answer: Use model validation with data annotations: public class UserModel Example code { [Required] [EmailAddress] public string Email { get; set; } } Return 400 Bad Request with a list of validation errors: { &qu…
Short answer: PI? Structured logging with libraries like Serilog, NLog, or built-in ILogger. Log requests and responses, including headers and payloads (avoid sensitive info). Use correlation IDs to trace requests across…
Short answer: Structured logging → Serilog, NLog, or built-in ILogger in ASP.NET Core. Request/response logging for debugging API calls. Correlation IDs to trace requests across microservices. Centralized logging → ELK S…
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Configure CORS policy on the server. Allow specific origins, headers, and methods. 👉 Example in ASP.NET Core: services.AddCors(options => { options.AddPolicy("MyPolicy", builder => builder.WithOrigins(" .AllowAnyHeader() .AllowAnyMethod()); }); Apply with app.UseCors("MyPolicy");.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Idempotent = multiple identical requests have the same effect as one request. Important for reliability and safe retries. HTTP Methods: GET, PUT, DELETE → Idempotent. POST → Not idempotent (creates new resource each time).
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: 2xx Success → 200 (OK), 201 (Created). 4xx Client Errors → 400 (Bad Request), 401 (Unauthorized), 404 (Not Found). 5xx Server Errors → 500 (Internal Server Error), 503 (Service Unavailable). Error responses should include structured messages: { "status": 400, "error": "Invalid Data", "details": "Email is required" }
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Horizontal scaling → Add more servers/containers. Load balancing across multiple instances. Database optimization (indexes, partitioning, read replicas). Caching at server, client, and CDN levels. Use asynchronous processing for long-running tasks. Apply rate limiting and throttling to prevent abuse. Adopt microservices architecture for modular scaling.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Use a load balancer (NGINX, HAProxy, AWS ELB, Azure Front Door). Distribute traffic across multiple instances to avoid bottlenecks. Support round-robin, least connections, or IP hash strategies. Enable health checks to route traffic only to healthy instances. Combine with auto-scaling for dynamic traffic management.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Reduce payload size (use JSON instead of XML, compress responses). Implement pagination for large datasets. Apply caching at multiple levels. Use async I/O (non-blocking calls). Minimize database calls (batch queries, stored procedures). Enable GZIP compression on responses. Profile and monitor using APM tools (New Relic, Application Insights).
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Client-side caching → Reduces server calls, but may serve stale data. Server-side caching → Faster responses, but increases memory usage. Proxy caching/CDN → Global scalability, but harder cache invalidation. Database caching (Redis) → Faster queries, but adds complexity and consistency issues.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: REST API? Add query parameters: Filtering: /products?category=shoes&brand=nike Sorting: /products?sort=price_asc Searching: /products?search=wireless+headphones Use LINQ/SQL queries in backend. Ensure query optimization with indexes. Implement validation to prevent SQL injection.
ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Add query parameters: Filtering: /products?category=shoes&brand=nike Sorting: /products?sort=price_asc Searching: /products?search=wireless+headphones Use LINQ/SQL queries in backend. Ensure query optimization with indexes. Implement validation to prevent SQL injection.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Deploy servers closer to users (geo-distributed hosting). Use CDNs for static content. Apply connection pooling for databases. Reduce number of API calls (batching, GraphQL alternative). Use HTTP/2 or gRPC for faster communication. Monitor latency with APM tools and optimize bottlenecks.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Swagger/OpenAPI → Standard for REST API design and documentation. Postman → Can generate collections and documentation automatically. Redoc → Static documentation from OpenAPI specs. RAML → RESTful API Modeling Language. Stoplight, Apiary, Docusaurus → Modern documentation and mocking platforms.
ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: In ASP.NET Core: Use Swashbuckle package to generate Swagger UI from controllers and annotations.
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" }); }); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API v1")); Other frameworks (Node.js: swagger-jsdoc, Spring Boot: springdoc-openapi) also support annotations and automatic documentation.
ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Use try-catch blocks in code to catch exceptions. Implement global exception handling middleware in ASP.NET Core: app.UseExceptionHandler(appError => { appError.Run(async context => {
context.Response.StatusCode = 500;
context.Response.ContentType = "application/json";
await context.Response.WriteAsync(new { message = "Internal Server Error" }.ToString()); }); }); Log exceptions for debugging and monitoring.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Indicates the requested resource does not exist. Use when resource ID is invalid or missing. Helps clients handle missing data gracefully. Example in ASP.NET Core: var user = db.Users.Find(id);
if(user == null) return NotFound(new { status=404, error="User not found" });
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Use model validation with data annotations: public class UserModel
{ [Required] [EmailAddress] public string Email { get; set; }
} Return 400 Bad Request with a list of validation errors: { "status": 400, "error": "Validation Failed", "details": ["Email is required", "Password must be at least 6 characters"] }
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: PI? Structured logging with libraries like Serilog, NLog, or built-in ILogger. Log requests and responses, including headers and payloads (avoid sensitive info). Use correlation IDs to trace requests across services. Centralize logs using ELK Stack, Seq, or Azure Application Insights. Log different levels: Information, Warning, Error,… Critical. Example……… using ILogger in ASP.NET Core: private readonly…
ILogger<MyController> _logger; public MyController(ILogger<MyController> logger) { _logger = logger; } [HttpGet("{id}")] public IActionResult GetUser(int id) { _logger.LogInformation("Fetching user with id {UserId}", id); try { var user = dbContext.Users.Find(id); if (user == null) { _logger.LogWarning("User with id {UserId} not found", id); return NotFound(); } return Ok(user); } catch (Exception ex) { _logger.LogError(ex, "Error fetching user with id {UserId}", id); return StatusCode(500, "Internal Server Error"); } } This covers all core aspects of error handling and debugging for REST APIs. public MyController(ILogger<MyController> logger)
{
_logger = logger;
} [HttpGet("{id}")] public IActionResult GetUser(int id)
{ _logger.LogInformation("Fetching user with id {UserId}", id); try {
var user = dbContext.Users.Find(id);
if (user == null)
{ _logger.LogWarning("User with id {UserId} not found", id); return NotFound();
}
return Ok(user);
} catch (Exception ex) { _logger.LogError(ex, "Error fetching user with id {UserId}", id); return StatusCode(500, "Internal Server Error");
}
} This covers all core aspects of error handling and debugging for REST APIs.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Structured logging → Serilog, NLog, or built-in ILogger in ASP.NET Core. Request/response logging for debugging API calls. Correlation IDs to trace requests across microservices. Centralized logging → ELK Stack, Seq, Azure Application Insights. Log errors, warnings, and important info (not sensitive data). Q&A
Structured logging → Serilog, NLog, or built-in ILogger in ASP.NET Core. Request/response logging for debugging API calls. Correlation IDs to trace requests across microservices. Centralized logging → ELK Stack, Seq, Azure Application Insights. Log errors, warnings, and important info (not sensitive data). Q&A
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
Install Toolliyo like an app Free
Home-screen access to tutorials, coding practice & career tools — no app store needed.
On iPhone/iPad: tap Share then Add to Home Screen.