📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Clean Code

Naming, small methods and classes, clear boundaries, avoiding duplication and hidden side effects, and writing C# that stays readable and maintainable.

  1. How do you name things well in C#? What makes a name intention-revealing, which .NET naming conventions matter, and why should you avoid abbreviations and type names in identifiers?

    Covers intention-revealing names, the .NET naming conventions (PascalCase, camelCase, I-prefix, Async suffix), and avoiding abbreviations, Hungarian notation and type names in identifiers.

    Junior Theory Clean Code Β· πŸ”— 2 follow-ups
  2. What does "clean code" actually mean in practice? How do readability and maintainability differ, and how would you tell whether a piece of C# code is clean?

    Defines clean code in practical terms, separates readability (understanding code now) from maintainability (changing it safely later), and gives observable tests for clean C#.

    Beginner Theory Clean Code Β· πŸ”— 3 follow-ups
  3. People say methods and classes should be small. How small is small? When should you split a method or class, and when does splitting actually make the code harder to follow?

    Explains the real criteria for splitting methods and classes (one level of abstraction, one reason to change, cohesion), and the failure mode of over-splitting into tiny, scattered indirection.

    Intermediate Theory Clean Code Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  4. What is a hidden side effect? Explain command-query separation, pure functions and immutability, and show how you would remove a side effect hiding inside a C# method.

    Covers what hidden side effects are and why they cause bugs, command-query separation (CQS), pure functions, immutability with records and init-only properties, and pushing side effects to the edges of the code.

    Mid-Level Theory Clean Code Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  5. You find the same discount calculation copy-pasted, with small differences, in three order handlers. Walk me through deciding whether to extract it. How do you tell real duplication from coincidental similarity, and what do you do if an earlier extraction turned out to be the wrong abstraction?

    Applies duplication judgment to real code: knowledge versus coincidental duplication, the rule of three, extracting safely under tests, and undoing a wrong abstraction by inlining it back.

    Mid-Level Theory Clean Code Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  6. Code review: an order service has a single 300-line PlaceOrder method that validates input, calculates prices and GST, writes to the database, charges the card and sends a confirmation email. How would you review it, and how would you make it readable step by step without breaking anything?

    A senior code review of a 300-line order method: ranking findings by severity (double charges, partial writes, swallowed errors, hidden time), writing kind and specific review comments, and a safe step-by-step plan to make it readable.

    Senior CodeReview Clean Code Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me