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

πŸ“š .NET Interview Questions

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

  1. A bug only appears in the Release build in production and you can't reproduce it in Debug. How do you investigate and fix it?

    Debugging Release-only bugs: the usual causes (removed debug-only code, JIT optimisations exposing races and non-volatile reads, shortened object lifetimes, timing), a systematic investigation with Release builds, logs, dumps and symbols, and preventing recurrence.

    Mid-Level Debugging Build System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  2. How do source files, content files and embedded resources work in a .NET build, and how do you read an embedded resource at run time?

    Build items for files: Compile, None, Content and EmbeddedResource, CopyToOutputDirectory and CopyToPublishDirectory, embedded resource naming and LogicalName, reading with GetManifestResourceStream, .resx localisation, and when to embed versus copy.

    Intermediate Theory Build System Β· πŸ”— 3 follow-ups
  3. What analysers run during a .NET build, how do IDE code style rules differ from CA code quality rules, and how do you configure them across a team?

    The .NET analyser ecosystem: built-in CA code quality analysers and IDE code style analysers, AnalysisLevel and AnalysisMode, EnforceCodeStyleInBuild, .editorconfig severities, third-party analyser packages, suppressions, and rolling stricter rules out to a team.

    Mid-Level Theory Build System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. How would you enable nullable reference types across a large existing .NET codebase without stopping feature work?

    Adopting nullable reference types at scale: what <Nullable> does, annotations and warnings, flow analysis and attributes, a project-by-project or file-by-file migration plan, handling public APIs and EF Core, and making nullable warnings errors.

    Senior RealWorldScenario Build System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. Review this Directory.Build.props that turns on TreatWarningsAsErrors with a long NoWarn list. What would you change, and how should warnings-as-errors be used in a team?

    A code review of warning policy: TreatWarningsAsErrors versus WarningsAsErrors and WarningsNotAsErrors, NoWarn versus severities in .editorconfig, CI-only versus local enforcement, AnalysisLevel pinning, and ratcheting a legacy codebase to zero warnings.

    Mid-Level CodeReview Build System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. Your team's builds have gone from 2 minutes to 15 and incremental builds rebuild everything. How do you find out why, using MSBuild binary logs?

    Diagnosing slow and non-incremental builds: capturing binary logs with -bl, reading them in the MSBuild Structured Log Viewer, finding slow targets, tasks and analysers, spotting broken incrementality, and fixes such as Inputs/Outputs, caching and build server settings.

    Senior Debugging Build System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. What actually happens between writing C# source code and the CPU executing it?

    The full journey of .NET code: Roslyn compiles C# to IL, the runtime loads the assembly, the JIT (with tiered compilation and Dynamic PGO) or an AOT compiler turns IL into machine code, and the CPU runs those instructions.

    Junior Theory Computer Basics Β· πŸ”— 2 follow-ups
  8. Explain binary, decimal and hexadecimal. How do you convert between them, and why do developers use hexadecimal so often?

    Positional number systems (base 2, 10 and 16), converting between them by hand and in C#, and why hex is the natural way to read bytes, memory addresses, colours, hashes and GUIDs.

    Beginner Theory Computer Basics Β· πŸ”— 2 follow-ups
  9. What are bits and bytes, how big are the .NET numeric types, and what happens when an int overflows?

    Bits, bytes and two's complement; the sizes and ranges of C# numeric types; unchecked versus checked overflow; and bitwise operations and flags enums.

    Junior Coding Computer Basics Β· πŸ”— 2 follow-ups
  10. What is character encoding? Explain ASCII and Unicode, and the difference between a character, a code point and a code unit.

    Why text needs an encoding, what ASCII covers and where it stops, how Unicode assigns code points, and how code points, code units, bytes and user-perceived characters (grapheme clusters) differ.

    Junior Theory Computer Basics Β· πŸ”— 2 follow-ups
  11. How do UTF-8 and UTF-16 differ, and why can string.Length give the wrong answer for user-visible characters in .NET?

    How UTF-8 and UTF-16 encode code points, surrogate pairs, why .NET strings are UTF-16 internally, when UTF-8 is used, and how to count, slice and limit text correctly with Rune and StringInfo.

    Mid-Level Theory Computer Basics Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  12. Customers report names like "José" in a CSV export opened in Excel, and an imported file shows "Jos�". How do you diagnose and fix these encoding problems?

    A practical debugging walkthrough for mojibake and replacement characters: reading the bytes in hex, identifying UTF-8 versus Windows-1252 and double encoding, the BOM and Excel, and fixing both export and import paths in .NET.

    Mid-Level Debugging Computer Basics Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  13. What is endianness, and how do you read and write multi-byte binary data correctly in .NET?

    Big-endian versus little-endian byte order, which platforms and protocols use which, network byte order, and the .NET APIs (BinaryPrimitives, BinaryReader, BitConverter, Guid) that handle byte order explicitly or implicitly.

    Mid-Level Theory Computer Basics Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  14. Review this C# method that builds a fixed-layout binary message for a partner system, including a customer name field limited to 32 bytes. What is wrong and how would you fix it?

    A code review that combines encoding and endianness: ASCII data loss, truncating by chars instead of bytes, splitting surrogate pairs, BitConverter's machine byte order, missing validation, and an allocation-free rewrite with BinaryPrimitives and UTF-8.

    Senior CodeReview Computer Basics Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  15. What are the main parts of a CPU (cores, registers, ALU, control unit and caches), and how do they work together to run your code?

    A tour of CPU architecture for software engineers: cores and hardware threads, the register file, the ALU and other execution units, the control unit, the cache hierarchy and the clock, and why each matters for .NET performance.

    Junior Theory CPU Β· πŸ”— 3 follow-ups
  16. Walk through the fetch-decode-execute instruction cycle. How does it apply to the machine code the .NET JIT generates?

    The instruction cycle (fetch, decode, execute, memory access, write-back), the instruction pointer, how jumps, calls and returns change the flow, and how to read a few lines of JIT-generated x64 or Arm64 assembly.

    Junior Theory CPU Β· πŸ”— 3 follow-ups
  17. What is CPU pipelining, and how do superscalar and out-of-order execution make modern CPUs fast? What stalls a pipeline?

    Instruction pipelining, superscalar issue, out-of-order execution with register renaming and the reorder buffer, the hazards that stall pipelines (data dependencies, branches, cache misses), and how dependency chains show up in .NET code.

    Mid-Level Theory CPU Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  18. Why can a loop over a sorted array run much faster than the same loop over unsorted data? Explain branch prediction and how to write branch-friendly .NET code.

    How CPUs predict conditional and indirect branches, what a misprediction costs, the classic sorted-versus-unsorted example, branchless techniques, how the .NET JIT uses conditional moves and Dynamic PGO, and how to measure mispredictions.

    Senior Coding CPU Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  19. What is cache locality? Why is iterating a 2D array row by row much faster than column by column, and how should it influence your choice of .NET data structures?

    Spatial and temporal locality, cache lines and hardware prefetching, row-major layout of C# multidimensional arrays, arrays of structs versus arrays of references, struct-of-arrays layouts, and benchmarking the effects.

    Mid-Level Coding CPU Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  20. A parallel loop that updates per-thread counters gets slower as you add cores. What is false sharing, how do you detect it, and how do you fix it in .NET?

    Cache coherence and why two threads writing different variables on the same cache line slow each other down, how to recognise and measure false sharing, and fixes: thread-local accumulation, padding, and avoiding shared writes.

    Senior Debugging CPU Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

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