.NET Interview Questions – Complete Study Guide A comprehensive collection of 130 interview questions for .NET developers Covering Arrays, …
.NET Interview Questions – Complete Study Guide A comprehensive collection of 130 interview questions for .NET developers Covering Arrays, …
A comprehensive collection of 130 interview questions for .NET developers Covering Arrays, Lists, Trees, and General .NET / C# / SQL — with clean C# implementations, multiple solutions per problem, and full complexity analysis.
This repository is built for .NET interview preparation and contains:
| Category | Questions | Format | Focus |
|---|---|---|---|
| Arrays | 20 | C# class implementations | Algorithms, manipulation, searching, sorting |
| *List* | 20 | C# class implementations | Collections, LINQ, dynamic data |
| Trees | 20 | C# class implementations | Recursion, BST, traversals, tree properties |
| General .NET | 70 | Q&A with code examples | Language fundamentals, frameworks, SQL, best practices |
Total: 130 interview questions covering the most commonly asked topics in .NET coding interviews — from junior to mid-senior level.
Every coding question (Arrays, Lists, Trees) includes:
The General .NET section provides:
…Understanding the types of questions you'll face helps you prepare strategically:
""Write a function that...""
These require you to code a solution on the spot. They test:
Covered by: Arrays (20), Lists (20), Trees (20) sections
""Explain the difference between...""
These test your understanding of language and platform fundamentals:
Covered by: General .NET (Q1–Q30)
""How would you implement...""
These test your practical knowledge of .NET ecosystem tools:
Covered by: General .NET (Q31–Q40)
""How do you ensure code quality...""
These assess your engineering maturity:
Covered by: General .NET (Q41–Q50)
""What is the difference between...""
These test your data layer knowledge:
Covered by: General .NET — SQL (Q51–Q70)
Arrays are one of the first topics in any coding interview because they test fundamental problem-solving, loops, conditions, indexes, and serve as a basis for hashing, sorting, and algorithm design.
| # | Question | Key Concepts | File |
|---|---|---|---|
| 1 | Array vs ArrayList vs List\ | Type safety, generics, performance | Array_ArrayList_List.cs |
| 2 | Reverse an array | Two-pointer, in-place | ReverseArray.cs |
| 3 | Maximum product subarray | Dynamic programming, tracking min/max | MaxProductSubarray.cs |
| 4 | Remove duplicates from an array | HashSet, sorting | RemoveDuplicates.cs |
| 5 | Find the missing number (1 to N) | Sum formula, XOR | FindMissingNumber.cs |
| 6 | Find intersection of two arrays | HashSet, two-pointer | FindIntersection.cs |
| 7 | First non-repeating element | Dictionary, frequency counting | FirstNonRepeatingElement.cs |
| 8 | Rotate array by K steps | Reversal algorithm, modular | RotateArray.cs |
| 9 | Check if array is a palindrome | Two-pointer | CheckPalindromeArray.cs |
| 10 | Flatten a 2D array | Nested iteration, LINQ | Flatten2DArray.cs |
| 11 | Find majority element (> n/2) | Boyer-Moore voting | MajorityElementFinder.cs |
| 12 | Find all pairs with a given sum | HashSet, two-pointer | FindPairsWithSum.cs |
| 13 | Binary search | Iterative, recursive | BinarySearchArray.cs |
| 14 | Maximum subarray sum (Kadane's) | Dynamic programming | MaxSubarraySum.cs |
| 15 | Element frequency counter | Dictionary, LINQ GroupBy | ElementFrequencyCounter.cs |
| 16 | Jagged vs multidimensional arrays | Memory layout, performance | JaggedVsMultidimensionalArray.cs |
| 17 | Shuffle an array (Fisher-Yates) | Randomization, in-place | ShuffleArray.cs |
| 18 | Resize an array in C# | Array.Resize, copying | ResizeArray.cs |
| 19 | Sort custom objects | IComparer, LINQ OrderBy | SortCustomObjects.cs |
| 20 | Array operations time complexity | O(1) access, O(n) search | Conceptual |
List is the most commonly used collection in .NET, offering dynamic resizing, type safety with generics, and integration with LINQ.
| # | Question | Key Concepts | File |
|---|---|---|---|
| 1 | Remove duplicates | HashSet, LINQ Distinct | RemoveDuplicates.cs |
| 2 | Find second largest element | Single-pass, sorting | FindSecondLargest.cs |
| 3 | Reverse a list | In-place, LINQ | ReverseList.cs |
| 4 | Sort a list (multiple approaches) | IComparer, LINQ, custom | SortList.cs |
| 5 | Element frequency counter | Dictionary, LINQ GroupBy | ElementFrequencyCounter.cs |
| 6 | Find common elements (intersection) | HashSet, LINQ Intersect | FindCommonElements.cs |
| 7 | Merge two sorted lists | Two-pointer merge | MergeTwoLists.cs |
| 8 | Find missing numbers in a range | HashSet, sequential check | FindMissingNumbers.cs |
| 9 | Rotate a list by K positions | Slice and concat, reversal | RotateList.cs |
| 10 | Shuffle a list (Fisher-Yates) | Randomization | ShuffleList.cs |
| 11 | Check if list is a palindrome | Two-pointer | CheckPalindromeList.cs |
| 12 | First non-repeating element | Dictionary, ordered scan | FirstNonRepeatingElement.cs |
| 13 | Group duplicate elements | Dictionary, LINQ GroupBy | GroupDuplicates.cs |
| 14 | Remove all occurrences of a value | RemoveAll, LINQ | RemoveAllOccurrences.cs |
| 15 | Find all pairs with a given sum | HashSet, brute force | FindPairsWithSum.cs |
| 16 | Split list into chunks | LINQ Chunk, manual slicing | SplitListIntoChunks.cs |
| 17 | Flatten nested lists | Recursion, SelectMany | FlattenNestedLists.cs |
| 18 | Max contiguous subarray sum | Kadane's algorithm | MaxContiguousSum.cs |
| 19 | Move all zeros to end | Two-pointer, partition | MoveZerosToEnd.cs |
| 20 | Compare list equality | SequenceEqual, set comparison | CompareListEquality.cs |
Trees test recursive thinking, divide-and-conquer, and appear in real-world applications like file systems, org charts, and DOM trees.
All binary tree problems share a minimal TreeNode class:
public class TreeNode
{
public int Value { get; set; }
public TreeNode? Left { get; set; }
public TreeNode? Right { get; set; }
public TreeNode(int value) { Value = value; }
}| # | Question | Key Concepts | File |
|---|---|---|---|
| 1 | Depth-first traversal (pre/in/post) | Recursion, stack-based iterative | DepthFirstTraversal.cs |
| 2 | Breadth-first / level order traversal | Queue, BFS | BreadthFirstTraversal.cs |
| 3 | Maximum depth of binary tree | Recursion, DFS | MaximumDepth.cs |
| 4 | Minimum depth of binary tree | BFS (optimal), recursion | MinimumDepth.cs |
| 5 | Check if tree is balanced | Height comparison, DFS | CheckBalancedTree.cs |
| 6 | Check if two trees are identical | Recursive compare | CheckIdenticalTrees.cs |
| 7 | Invert (mirror) a binary tree | Recursive swap, BFS | InvertBinaryTree.cs |
| 8 | Validate BST | In-order check, min/max bounds | ValidateBST.cs |
| 9 | Search in a BST | Recursive, iterative | SearchBST.cs |
| 10 | Insert into a BST | Recursive, iterative | InsertIntoBST.cs |
| 11 | Find min/max in BST | Leftmost/rightmost node | FindMinMaxBST.cs |
| 12 | Lowest common ancestor | BST property, general tree | LowestCommonAncestor.cs |
| 13 | Diameter of binary tree | DFS, height tracking | DiameterOfBinaryTree.cs |
| 14 | Check if tree is symmetric | Mirror comparison | CheckSymmetricTree.cs |
| 15 | Serialize / deserialize tree | BFS, pre-order string | SerializeDeserializeTree.cs |
| 16 | Path sum (root-to-leaf = target) | DFS, backtracking | PathSum.cs |
| 17 | All root-to-leaf paths | DFS, path building | RootToLeafPaths.cs |
| 18 | Count total nodes & leaf nodes | Recursion, BFS | CountNodes.cs |
| 19 | Kth smallest in BST | In-order traversal | KthSmallestInBST.cs |
| 20 | Build tree from relationships | N-ary tree, org chart | BuildTreeFromRelationships.cs |
These conceptual questions cover the .NET platform, C# language, ASP.NET Core framework, testing, and SQL — essential for the non-coding portion of interviews.
| # | Question |
|---|---|
| 1 | What is .NET? |
| 2 | Can you explain the Common Language Runtime (CLR)? |
| 3 | What is the difference between managed and unmanaged code? |
| 4 | Explain the basic structure of a C# program |
| 5 | What are Value Types and Reference Types in C#? |
| 6 | What is garbage collection in .NET? |
| 7 | Explain exception handling in C# |
| 8 | What are the different types of classes in C#? |
| 9 | What is a namespace and how is it used? |
| 10 | What is encapsulation? |
| # | Question |
|---|---|
| 11 | Explain polymorphism and its types in C# |
| 12 | What are delegates and how are they used? |
| 13 | What is LINQ? Give an example |
| 14 | Abstract class vs interface — what's the difference? |
| 15 | How do you manage memory in .NET? |
| 16 | Explain threading in .NET |
| 17 | What is async/await and how does it work? |
| 18 | Describe Entity Framework and its advantages |
| 19 | What are extension methods? |
| 20 | How do you handle exceptions in a Task-returning method? |
| # | Question |
|---|---|
| 21 | What is reflection in .NET? |
| 22 | Explain middleware in ASP.NET Core |
| 23 | Describe Dependency Injection in .NET Core |
| 24 | What is the purpose of .NET Standard? |
| 25 | Differences: .NET Core vs .NET Framework vs Xamarin |
| 26 | How does GC work and how to |
No open issues yet, or sync has not completed.