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 3226–3250 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Can MSTest support data-driven testing?

Short answer: How? Yes, MSTest supports data-driven tests using [DataTestMethod] and [DataRow] attributes: [DataTestMethod] [DataRow(2, 3, 5)] [DataRow(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected)…

Testing Read answer
Mid PDF
Can MSTest support data-driven testing? How?

Short answer: Yes, MSTest supports data-driven tests using [DataTestMethod] and [DataRow] ttributes: [DataTestMethod] [DataRow(2, 3, 5)] [DataRow(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected) { var…

Testing Read answer
Mid PDF
How do you categorize or group tests in MSTest?

Short answer: Use the [TestCategory("CategoryName")] attribute to group tests for filtering. [TestMethod] [TestCategory("Integration")] public void IntegrationTest() { } Real-world example (ShopNest)…

Testing Read answer
Mid PDF
How do you ignore tests temporarily in MSTest?

Short answer: Use the [Ignore("Reason")] attribute on the test method or class. [Ignore("Test is temporarily disabled")] [TestMethod] public void SkippedTest() { } Real-world example (ShopNest) ShopNe…

Testing Read answer
Mid PDF
How to run MSTest tests via command line or Azure DevOps pipelines?

Short answer: Use dotnet test CLI for .NET Core MSTest projects: dotnet test YourTestProject.csproj In Azure DevOps, use the Visual Studio Test task or the DotNetCoreCLI task to run tests during builds and releases. Real…

Testing Read answer
Mid PDF
How do you mock dependencies when using MSTest?

Short answer: MSTest itself does not provide mocking capabilities. Use mocking libraries like Moq or NSubstitute alongside MSTest to mock dependencies. Example with Moq: var mockService = new Mock<IService>(); Exam…

Testing Read answer
Mid PDF
How do you create a mock object using Moq?

Short answer: var mockService = new Mock<IService>(); var service = mockService.Object; // use this in your test Example code var mockService = new Mock<IService>(); var service = mockService.Object; // use t…

Testing Read answer
Mid PDF
How do you set up method expectations in Moq?

Short answer: mockService.Setup(s => s.GetData()).Returns("Mocked Data"); This configures the mock to return "Mocked Data" when GetData() is called. Example code mockService.Setup(s => s.GetData…

Testing Read answer
Mid PDF
How do you verify that a method was called on a mock object?

Short answer: mockService.Verify(s => s.Save(), Times.Once); This asserts that Save() was called exactly once during the test. Example code mockService.Verify(s => s.Save(), Times.Once); This asserts that Save() wa…

Testing Read answer
Mid PDF
How do you mock properties using Moq?

Short answer: mockService.SetupGet(s => s.Name).Returns("MockName"); This sets up a mocked property getter to return a specific value. Example code mockService.SetupGet(s => s.Name).Returns("MockName…

Testing Read answer
Mid PDF
Can you mock methods with parameters?

Short answer: How? mockService.Setup(s => s.GetData(It.IsAny<int>())).Returns("Data"); You can specify argument matchers like It.IsAny<T>() to mock methods with parameters. Example code How? mock…

Testing Read answer
Mid PDF
Can you mock methods with parameters? How?

Short answer: mockService.Setup(s => s.GetData(It.IsAny<int>())).Returns("Data"); You can specify argument matchers like It.IsAny<T>() to mock methods with parameters. Explain a bit more mockServ…

Testing Read answer
Mid PDF
How do you mock asynchronous methods with Moq?

Short answer: mockService.Setup(s => s.GetDataAsync()).ReturnsAsync("Async Data"); Moq supports ReturnsAsync to mock async methods returning Task<T>. Example code mockService.Setup(s => s.GetDataAsy…

Testing Read answer
Mid PDF
What are the limitations of mocking?

Short answer: Cannot mock non-virtual or sealed methods/classes without special tooling. Over-mocking can make tests fragile and hard to maintain. Complex mocks can hide design issues in the code. Mocks don’t guarantee r…

Testing Read answer
Mid PDF
How do you handle mocking for classes that are not interfaces or virtual methods?

Short answer: Use tools like Microsoft Fakes or JustMock for advanced mocking of sealed classes or non-virtual methods. Alternatively, refactor code to depend on interfaces or make methods virtual for easier mocking. Tes…

Testing Read answer
Mid PDF
How does TDD improve software quality?

Short answer: Ensures code is testable and well-designed. Helps catch bugs early. Provides a safety net for refactoring. Encourages simple, focused code. Improves documentation through tests. Real-world example (ShopNest…

Testing Read answer
Mid PDF
What are some challenges faced when adopting TDD?

Short answer: Initial learning curve and mindset shift. Writing tests for complex scenarios or legacy code. Overhead in writing and maintaining tests. Possible resistance from teams unfamiliar with the practice. Say this…

Testing Read answer
Mid PDF
How does TDD relate to unit testing?

Short answer: TDD relies heavily on unit tests as the foundation. It’s a process where unit tests are created first to define requirements, then production code is written to pass those tests. Real-world example (ShopNes…

Testing Read answer
Mid PDF
Can you describe a practical example where you used TDD?

Short answer: (Example) I wrote a simple calculator class using TDD: First, I wrote a test for addition, saw it fail, implemented Add() method, passed the test, then refactored. Repeated for subtraction, multiplication,…

Testing Read answer
Mid PDF
What tools and frameworks support TDD in .NET?

Short answer: Testing frameworks: xUnit, NUnit, MSTest. Mocking libraries: Moq, NSubstitute. IDE support: Visual Studio’s Test Explorer. CI tools: Azure DevOps, GitHub Actions, Jenkins for automated test runs. Real-world…

Testing Read answer
Mid PDF
How do you handle dependencies when writing tests in TDD?

Short answer: Use mocking and dependency injection to isolate the unit under test, allowing tests to focus on behavior without relying on external resources. Real-world example (ShopNest) ShopNest unit tests cover pricin…

Testing Read answer
Mid PDF
How do you ensure tests are fast and reliable in TDD?

Short answer: Mock external dependencies. Keep tests focused and independent. Avoid I/O operations in unit tests. Run tests frequently during development. Real-world example (ShopNest) ShopNest unit tests cover pricing a…

Testing Read answer
Mid PDF
How do you write integration tests in .NET?

Short answer: You write integration tests by creating test projects that exercise multiple components together, often involving real or in-memory databases, services, or APIs. You use frameworks like xUnit or NUnit and c…

Testing Read answer
Mid PDF
What frameworks support integration testing in .NET?

Short answer: xUnit, NUnit, MSTest for test execution. Entity Framework Core InMemory provider or SQLite for database testing. TestServer in ASP.NET Core for testing web APIs. Tools like Respawn for database cleanup. Rea…

Testing Read answer
Mid PDF
How do you test database interactions in integration tests?

Short answer: You use a test database or in-memory database to run queries and verify data persistence and retrieval, ensuring the data layer works as expected without affecting production data. Real-world example (ShopN…

Testing Read answer

Unit Testing C# Programming Tutorial · Testing

Short answer: How? Yes, MSTest supports data-driven tests using [DataTestMethod] and [DataRow] attributes: [DataTestMethod] [DataRow(2, 3, 5)] [DataRow(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected)

Example code

{
var calculator = new Calculator();
var result = calculator.Add(a, b); Assert.AreEqual(expected, result); }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Yes, MSTest supports data-driven tests using [DataTestMethod] and [DataRow] ttributes: [DataTestMethod] [DataRow(2, 3, 5)] [DataRow(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected) { var calculator = new Calculator(); var result = calculator.Add(a, b); ssert.AreEqual(expected, result); } Yes, MSTest supports data-driven tests using… [DataTestMethod] and [DataRow] ttributes: [DataTestMethod]…

Explain a bit more

[DataRow(2, 3, 5)] [DataRow(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected) { var calculator = new Calculator(); var result = calculator.Add(a, b); ssert.AreEqual(expected, result); }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Use the [TestCategory("CategoryName")] attribute to group tests for filtering. [TestMethod] [TestCategory("Integration")] public void IntegrationTest() { }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Use the [Ignore("Reason")] attribute on the test method or class. [Ignore("Test is temporarily disabled")] [TestMethod] public void SkippedTest() { }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Use dotnet test CLI for .NET Core MSTest projects: dotnet test YourTestProject.csproj In Azure DevOps, use the Visual Studio Test task or the DotNetCoreCLI task to run tests during builds and releases.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: MSTest itself does not provide mocking capabilities. Use mocking libraries like Moq or NSubstitute alongside MSTest to mock dependencies. Example with Moq: var mockService = new Mock<IService>();

Example code

mockService.Setup(s => s.GetData()).Returns("Test Data"); Moq Framework (Mocking)

Real-world example (ShopNest)

When testing ShopNest’s order service, mock IPaymentGateway so tests do not call Razorpay.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: var mockService = new Mock<IService>(); var service = mockService.Object; // use this in your test

Example code

var mockService = new Mock<IService>();
var service = mockService.Object; // use this in your test

Real-world example (ShopNest)

When testing ShopNest’s order service, mock IPaymentGateway so tests do not call Razorpay.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: mockService.Setup(s => s.GetData()).Returns("Mocked Data"); This configures the mock to return "Mocked Data" when GetData() is called.

Example code

mockService.Setup(s => s.GetData()).Returns("Mocked Data"); This configures the mock to return "Mocked Data" when GetData() is called.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: mockService.Verify(s => s.Save(), Times.Once); This asserts that Save() was called exactly once during the test.

Example code

mockService.Verify(s => s.Save(), Times.Once); This asserts that Save() was called exactly once during the test.

Real-world example (ShopNest)

When testing ShopNest’s order service, mock IPaymentGateway so tests do not call Razorpay.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: mockService.SetupGet(s => s.Name).Returns("MockName"); This sets up a mocked property getter to return a specific value.

Example code

mockService.SetupGet(s => s.Name).Returns("MockName"); This sets up a mocked property getter to return a specific value.

Real-world example (ShopNest)

When testing ShopNest’s order service, mock IPaymentGateway so tests do not call Razorpay.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: How? mockService.Setup(s => s.GetData(It.IsAny<int>())).Returns("Data"); You can specify argument matchers like It.IsAny<T>() to mock methods with parameters.

Example code

How? mockService.Setup(s => s.GetData(It.IsAny<int>())).Returns("Data"); You can specify argument matchers like It.IsAny<T>() to mock methods with parameters.

Real-world example (ShopNest)

When testing ShopNest’s order service, mock IPaymentGateway so tests do not call Razorpay.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: mockService.Setup(s => s.GetData(It.IsAny<int>())).Returns("Data"); You can specify argument matchers like It.IsAny<T>() to mock methods with parameters.

Explain a bit more

mockService.Setup(s => s.GetData(It.IsAny<int>())).Returns("Data"); You can specify argument matchers like It.IsAny<T>() to mock methods with parameters. mockService.Setup(s => s.GetData(It.IsAny<int>())).Returns("Data"); You can specify argument matchers like It.IsAny<T>() to mock methods with parameters. mockService.Setup(s => s.GetData(It.IsAny<int>())).Returns("Data"); You can specify argument matchers like It.IsAny<T>() to mock methods with parameters.

Real-world example (ShopNest)

When testing ShopNest’s order service, mock IPaymentGateway so tests do not call Razorpay.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: mockService.Setup(s => s.GetDataAsync()).ReturnsAsync("Async Data"); Moq supports ReturnsAsync to mock async methods returning Task<T>.

Example code

mockService.Setup(s => s.GetDataAsync()).ReturnsAsync("Async Data"); Moq supports ReturnsAsync to mock async methods returning Task<T>.

Real-world example (ShopNest)

When testing ShopNest’s order service, mock IPaymentGateway so tests do not call Razorpay.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Cannot mock non-virtual or sealed methods/classes without special tooling. Over-mocking can make tests fragile and hard to maintain. Complex mocks can hide design issues in the code. Mocks don’t guarantee real-world integration correctness.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Use tools like Microsoft Fakes or JustMock for advanced mocking of sealed classes or non-virtual methods. Alternatively, refactor code to depend on interfaces or make methods virtual for easier mocking. Test Driven Development (TDD)

Real-world example (ShopNest)

When testing ShopNest’s order service, mock IPaymentGateway so tests do not call Razorpay.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Ensures code is testable and well-designed. Helps catch bugs early. Provides a safety net for refactoring. Encourages simple, focused code. Improves documentation through tests.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Initial learning curve and mindset shift. Writing tests for complex scenarios or legacy code. Overhead in writing and maintaining tests. Possible resistance from teams unfamiliar with the practice.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: TDD relies heavily on unit tests as the foundation. It’s a process where unit tests are created first to define requirements, then production code is written to pass those tests.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: (Example) I wrote a simple calculator class using TDD: First, I wrote a test for addition, saw it fail, implemented Add() method, passed the test, then refactored. Repeated for subtraction, multiplication, etc., ensuring robust code with full test coverage.

Real-world example (ShopNest)

Arrange a cart with 2 items → Act Checkout() → Assert total and that payment was called once.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Testing frameworks: xUnit, NUnit, MSTest. Mocking libraries: Moq, NSubstitute. IDE support: Visual Studio’s Test Explorer. CI tools: Azure DevOps, GitHub Actions, Jenkins for automated test runs.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Use mocking and dependency injection to isolate the unit under test, allowing tests to focus on behavior without relying on external resources.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Mock external dependencies. Keep tests focused and independent. Avoid I/O operations in unit tests. Run tests frequently during development.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: You write integration tests by creating test projects that exercise multiple components together, often involving real or in-memory databases, services, or APIs. You use frameworks like xUnit or NUnit and configure dependencies to mimic production-like environments.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: xUnit, NUnit, MSTest for test execution. Entity Framework Core InMemory provider or SQLite for database testing. TestServer in ASP.NET Core for testing web APIs. Tools like Respawn for database cleanup.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: You use a test database or in-memory database to run queries and verify data persistence and retrieval, ensuring the data layer works as expected without affecting production data.

Real-world example (ShopNest)

Arrange a cart with 2 items → Act Checkout() → Assert total and that payment was called once.

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