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

Arrays

Single-dimensional, multi-dimensional and jagged arrays, array covariance, bounds checking and array performance in .NET 10.

  1. How do single-dimensional arrays work in C#? How do you declare, initialise, copy, resize, slice and search them, and when would you use an array instead of List<T>?

    Single-dimensional arrays in C# 14: declaration and collection expressions, fixed length and zero-initialisation, the Array helper methods, copying versus slicing, ranges that copy, and choosing between arrays and List<T>.

    Junior Theory Arrays Β· πŸ”— 3 follow-ups
  2. What is the difference between multi-dimensional (rectangular) arrays and jagged arrays in C#? How are they laid out in memory, which is faster, and when would you flatten a grid into a single-dimensional array?

    Rectangular int[,] versus jagged int[][] arrays: syntax, memory layout, bounds checks and performance, LINQ and Span support, and the flattened 1-D array alternative for grids, images and matrices.

    Mid-Level Theory Arrays Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  3. This code compiles but throws ArrayTypeMismatchException at run time: object[] items = new string[3]; items[0] = 42;. Explain array covariance in C#, why it exists, what it costs, and how generic variance and read-only interfaces avoid the problem.

    Array covariance in .NET: why string[] converts to object[], the run-time store check and ArrayTypeMismatchException, its hidden performance cost, the Span<T> constructor trap, and safe alternatives through generic variance.

    Mid-Level Debugging Arrays Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  4. What is bounds checking in .NET arrays? Why does it exist, when does the JIT eliminate it, and how do you write loops that avoid it safely (and when is unsafe code justified)?

    Array bounds checking in .NET 10: the check the JIT emits, why it gives memory safety, patterns that let the JIT remove it, patterns that keep it, how to inspect generated code, and the trade-offs of unsafe access.

    Senior Theory Arrays Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  5. A .NET service that processes large batches spends a lot of time in garbage collection, and memory profiling shows most allocations are short-lived arrays. How do you make array-heavy code fast? Explain ArrayPool, the Large Object Heap, cache locality, copying APIs, spans and SIMD.

    Array performance in .NET 10 as a real-world scenario: allocation and LOH costs, ArrayPool rent/return rules, uninitialised and pinned arrays, cache-friendly layouts, vectorised copy and fill APIs, TensorPrimitives and SIMD, and how to measure.

    Senior RealWorldScenario Arrays Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

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