Interview Q&A

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

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 101–105 of 105

Career & HR topics

By tech stack

Mid PDF
How would you handle exceptions in REST APIs?

Implement global exception handling using middleware to catch unhandled exceptions. Return consistent and meaningful error responses. Log errors for debugging and monitoring. Example in ASP.NET Core: pp.UseExceptionHandl…

REST API Read answer
Junior PDF
What is a standard approach for sending error responses in REST

Answer: PIs? Return a structured JSON response with: status → HTTP status code error → Short message details → Optional for debugging Example: { "status": 400, "error": "Bad Request", "details": "Email is required" } Wha…

REST API Read answer
Mid PDF
What does the "404 Not Found" status code mean, and how can it be used for error handling?

404 Not Found indicates the requested resource does not exist. Use it when a client requests an invalid ID or non-existent resource. Helps clients gracefully handle missing data. Example in ASP.NET Core: var user = dbCon…

REST API Read answer
Mid PDF
How would you handle validation errors in a REST API?

Use model validation with data annotations. Return 400 Bad Request with a list of validation errors. Example: public class UserModel { [Required(ErrorMessage = "Email is required")] [EmailAddress(ErrorMessage = "Invalid…

REST API Read answer
Mid PDF
What logging strategies would you use to debug issues in a REST

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. Cen…

REST API Read answer

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

  • Implement global exception handling using middleware to catch unhandled

exceptions.

  • Return consistent and meaningful error responses.
  • Log errors for debugging and monitoring.

Example in ASP.NET Core:

pp.UseExceptionHandler(appError =>

{

ppError.Run(async context =>

{
context.Response.StatusCode = 500; // Internal Server Error
context.Response.ContentType = "application/json";
var contextFeature =

context.Features.Get<IExceptionHandlerFeature>();

if(contextFeature != null)
{

// Log exception (use ILogger)

wait context.Response.WriteAsync(new

{

StatusCode = context.Response.StatusCode,

Message = "Internal Server Error.",

Detail = contextFeature.Error.Message

}.ToString());

}

});

});

Permalink & share

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

Answer: PIs? Return a structured JSON response with: status → HTTP status code error → Short message details → Optional for debugging Example: { "status": 400, "error": "Bad Request", "details": "Email is required" }

What interviewers expect

  • A clear definition tied to REST API in ASP.NET Web API projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production ASP.NET Web API application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in ASP.NET Web API architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

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

  • 404 Not Found indicates the requested resource does not exist.
  • Use it when a client requests an invalid ID or non-existent resource.
  • Helps clients gracefully handle missing data.

Example in ASP.NET Core:

var user = dbContext.Users.Find(id);
if (user == null)
{
return NotFound(new { status = 404, error = "User not found" });
}
Permalink & share

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

  • Use model validation with data annotations.
  • Return 400 Bad Request with a list of validation errors.

Example:

public class UserModel
{

[Required(ErrorMessage = "Email is required")]

[EmailAddress(ErrorMessage = "Invalid email format")]

public string Email { get; set; }

[Required]

[MinLength(6, ErrorMessage = "Password must be at least 6

characters")]

public string Password { get; set; }
}

// Controller action

[HttpPost("register")]

public IActionResult Register([FromBody] UserModel model)
{
if (!ModelState.IsValid)
{
var errors = ModelState.Values.SelectMany(v =>
v.Errors).Select(e => e.ErrorMessage);
return BadRequest(new { status = 400, error = "Validation
Failed", details = errors });
}
return Ok("User registered successfully");
}
Permalink & share

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

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.

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