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

Language Basics

Variables, constants, data types, literals, operators, expressions, statements, control flow, methods, parameters, return types and local functions in C# 14.

  1. What is the difference between a local variable, a const, a readonly field and a static readonly field in C#, and how do literals such as numeric suffixes, digit separators and raw string literals work?

    Variables, constants and literals in C# 14: definite assignment, const versus readonly, the const versioning trap, and every literal form you meet in real code.

    Junior Theory Language Basics Β· πŸ”— 2 follow-ups
  2. What are the built-in numeric data types in C#? When do you use int, long, double or decimal, and how do overflow, checked arithmetic and floating-point precision affect real code?

    Choosing numeric types in C#: integral versus binary floating point versus decimal, silent overflow and checked contexts, NaN and Infinity, rounding, and money calculations.

    Junior Coding Language Basics Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  3. Explain the C# operators you use daily, including the null operators (?., ??, ??=), short-circuit evaluation, integer division and operator precedence. Where do they cause bugs?

    Arithmetic, comparison, logical, null-handling, pattern and index/range operators in C# 14, with precedence rules and the bugs each one commonly causes.

    Junior Theory Language Basics Β· πŸ”— 3 follow-ups
  4. What is the difference between an expression and a statement in C#? Explain switch expressions, pattern matching and expression-bodied members, and when you would use each.

    Expressions versus statements in C# 14, and the expression-oriented features built on that split: switch expressions, the pattern kinds, throw expressions and expression-bodied members.

    Mid-Level Theory Language Basics Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  5. Walk through C# control flow: if, switch, for, foreach, while, break, continue and return. What does foreach compile to, and which loop bugs should you watch for?

    C# selection, iteration and jump statements, how foreach is lowered for arrays, List<T> and IEnumerable<T>, and the classic loop bugs: closure capture, modifying during enumeration, off-by-one and multiple enumeration.

    Junior Debugging Language Basics Β· πŸ”— 2 follow-ups
  6. How are arguments passed to methods in C#? Explain pass-by-value for value and reference types, ref, out, in, ref readonly, params, and optional and named parameters.

    C# parameter passing in depth: copies of values versus copies of references, the ref/out/in/ref readonly modifiers, params collections (C# 13), optional and named arguments, and their performance and versioning trade-offs.

    Mid-Level Theory Language Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. Code review: a service method returns null when an order is not found, reports errors through two out parameters, returns its internal List<Order> directly, and is called from async code. How would you redesign its return types, and what return options does C# give you?

    Choosing method return types in C#: void, values, tuples, out parameters, result objects, ref returns, IEnumerable and IAsyncEnumerable, Task and ValueTask, reviewed through a realistic service method.

    Senior CodeReview Language Basics Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  8. What are local functions in C#? How do they differ from lambdas in capture, allocation and recursion, and when do you use a static local function?

    Local functions versus lambdas in C#: syntax, struct versus class closures, delegate allocation, recursion, generics, static local functions, and the eager-validation pattern for iterators and async methods.

    Mid-Level Theory Language Basics Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  9. How do methods work in C#? Explain instance versus static methods, method signatures and overloading (and how overload resolution picks a method), expression-bodied methods, and extension methods including the C# 14 extension members syntax.

    C# methods end to end: instance and static, signatures, overloading rules, expression-bodied form, and classic and C# 14 extension members.

    Mid-Level Theory Language Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

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