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 4551–4575 of 4608

Career & HR topics

By tech stack

Popular tracks

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
Junior PDF
What is the difference between TDD and traditional testing?

Short answer: TDD writes tests before code, driving design and implementation. Traditional testing usually happens after coding, as a verification step. TDD promotes continuous testing and refactoring, while traditional…

Testing Read answer
Junior PDF
What is integration testing and how is it different from unit testing?

Short answer: Integration testing verifies that multiple components or systems work together correctly, unlike unit testing which tests individual units in isolation. It focuses on interactions between modules, databases…

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
Mid PDF
How do you handle configuration for integration tests?

Short answer: Use separate configuration files or environment variables for tests, injecting connection strings and service endpoints specific to the test environment. Real-world example (ShopNest) ShopNest unit tests co…

Testing Read answer
Mid PDF
How do you isolate integration tests from production data?

Short answer: Use test-specific databases or in-memory databases. Use transactions with rollback or database cleanup scripts between tests. Avoid connecting to production environments during tests. Real-world example (Sh…

Testing Read answer
Junior PDF
What is mocking/stubbing in the context of integration testing?

Short answer: Mocking/stubbing replaces external dependencies like web services or message queues with controlled test doubles to isolate the parts under test and control external behavior without invoking real services.…

Testing Read answer
Mid PDF
How do you automate integration tests in CI/CD pipelines?

Short answer: Configure pipeline steps to run integration tests after build, using test runners, setting up test databases, and cleaning up after tests. Use containers or managed services to mimic production-like environ…

Testing Read answer
Mid PDF
How do you manage dependencies in integration tests?

Short answer: Leverage dependency injection to replace real services with test implementations or mocks. Use setup and teardown methods to initialize and dispose of dependencies per test. Real-world example (ShopNest) Sh…

Testing Read answer
Junior PDF
What is the role of in-memory databases like InMemory EF Core for integration testing?

Short answer: In-memory databases allow fast, isolated testing of data access code without a real database, making integration tests easier to run and maintain, but may lack certain behaviors of real databases (like rela…

Testing Read answer
Mid PDF
How do you structure your test projects in .NET solutions?

Short answer: Typically, test projects mirror the structure of the production projects, organized by feature or layer. For example, you might have MyApp.Core.Tests, MyApp.Web.Tests, and MyApp.Data.Tests. Tests are groupe…

Testing Read answer
Mid PDF
How do you mock external service calls in unit tests?

Short answer: Use mocking frameworks like Moq to create mock implementations of service interfaces. For HTTP calls, tools like HttpClientFactory with a mocked HttpMessageHandler or libraries like RichardSzalay.MockHttp h…

Testing Read answer
Junior PDF
What is dependency injection and how does it facilitate testing?

Short answer: Dependency Injection (DI) is a design pattern where dependencies are provided rather than created inside a class. DI makes testing easier by allowing tests to inject mock or fake implementations of dependen…

Testing Read answer
Mid PDF
How do you test private methods or classes?

Short answer: Best practice is to test private methods indirectly through public methods. If needed, internal methods can be exposed to test projects using InternalsVisibleTo attribute. Reflection can be used but is gene…

Testing Read answer
Mid PDF
How do you test asynchronous code in .NET?

Short answer: Mark test methods with async Task and use await to call asynchronous methods. Most test frameworks like xUnit, NUnit, and MSTest support async tests natively. [TestMethod] public async Task AsyncMethod_Shou…

Testing Read answer
Mid PDF
How do you test exception handling in unit tests?

Short answer: Use assertion methods that expect exceptions. For example, in MSTest: [TestMethod] [ExpectedException(typeof(InvalidOperationException))] public void Method_ShouldThrowException() Example code { myService.D…

Testing Read answer
Mid PDF
What are test doubles and types of test doubles?

Short answer: Test doubles are objects used in place of real components for testing. Types include: Dummy: Passed but never used. Stub: Provides canned responses. Mock: Verifies interactions. Fake: Working but simplified…

Testing Read answer
Junior PDF
What is the difference between mocks, stubs, and fakes?

Short answer: Stub: Provides predefined data to the test. Mock: Verifies that certain interactions happened. Fake: Has a working implementation, often simpler than production. Real-world example (ShopNest) When testing S…

Testing Read answer

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: TDD writes tests before code, driving design and implementation. Traditional testing usually happens after coding, as a verification step. TDD promotes continuous testing and refactoring, while traditional testing may be more manual or batch-driven. Integration Testing

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: Integration testing verifies that multiple components or systems work together correctly, unlike unit testing which tests individual units in isolation. It focuses on interactions between modules, databases, APIs, or external services.

Example code

Integration testing verifies that multiple components or systems work together correctly, unlike unit testing which tests individual units in isolation. It focuses on interactions between modules, databases, APIs, or external services.

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

Unit Testing C# Programming Tutorial · Testing

Short answer: Use separate configuration files or environment variables for tests, injecting connection strings and service endpoints specific to the test environment.

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 test-specific databases or in-memory databases. Use transactions with rollback or database cleanup scripts between tests. Avoid connecting to production environments during 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: Mocking/stubbing replaces external dependencies like web services or message queues with controlled test doubles to isolate the parts under test and control external behavior without invoking real services.

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: Configure pipeline steps to run integration tests after build, using test runners, setting up test databases, and cleaning up after tests. Use containers or managed services 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: Leverage dependency injection to replace real services with test implementations or mocks. Use setup and teardown methods to initialize and dispose of dependencies per test.

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: In-memory databases allow fast, isolated testing of data access code without a real database, making integration tests easier to run and maintain, but may lack certain behaviors of real databases (like relational constraints). Practical & Advanced Topics

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: Typically, test projects mirror the structure of the production projects, organized by feature or layer. For example, you might have MyApp.Core.Tests, MyApp.Web.Tests, and MyApp.Data.Tests. Tests are grouped by functionality to keep code maintainable and discoverable.

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 frameworks like Moq to create mock implementations of service interfaces. For HTTP calls, tools like HttpClientFactory with a mocked HttpMessageHandler or libraries like RichardSzalay.MockHttp help simulate HTTP responses.

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: Dependency Injection (DI) is a design pattern where dependencies are provided rather than created inside a class. DI makes testing easier by allowing tests to inject mock or fake implementations of dependencies, isolating the unit under test.

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: Best practice is to test private methods indirectly through public methods. If needed, internal methods can be exposed to test projects using InternalsVisibleTo attribute. Reflection can be used but is generally discouraged as it breaks encapsulation.

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: Mark test methods with async Task and use await to call asynchronous methods. Most test frameworks like xUnit, NUnit, and MSTest support async tests natively. [TestMethod] public async Task AsyncMethod_ShouldReturnTrue()

Example code

{
var result = await myService.DoWorkAsync(); Assert.IsTrue(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 assertion methods that expect exceptions. For example, in MSTest: [TestMethod] [ExpectedException(typeof(InvalidOperationException))] public void Method_ShouldThrowException()

Example code

{ myService.DoSomethingInvalid(); } Or in xUnit: await Assert.ThrowsAsync<InvalidOperationException>(() => myService.DoSomethingInvalidAsync());

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: Test doubles are objects used in place of real components for testing. Types include: Dummy: Passed but never used. Stub: Provides canned responses. Mock: Verifies interactions. Fake: Working but simplified implementation. Spy: Records information about calls.

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: Stub: Provides predefined data to the test. Mock: Verifies that certain interactions happened. Fake: Has a working implementation, often simpler than production.

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
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