C# Programming - MCQ Practice Questions
C# (.NET) MCQs — OOP, collections, LINQ & exception handling.
290 questions | 100% Free
Which collection allows duplicate keys in C#?
What does the Count property of a collection return in C#?
Which collection in C# implements LIFO (Last In First Out) principle?
What will be the output of the following code? List<int> nums = new List<int> {1, 2, 3}; nums.Add(4); Console.WriteLine(nums.Count);
Which collection in C# maintains insertion order and allows duplicate elements?
Which collection throws an exception when you try to dequeue from an empty Queue<T>?
What is the time complexity of accessing an element by index in List<T>?
Which method in Stack<T> returns the top element without removing it?
Which IEnumerable method should be used to filter elements based on a condition and maintain type safety?
In a HashSet<T>, what happens when you try to add a duplicate element?
Which LINQ method should you use to transform each element of a collection into a new form?
Which method in Queue<T> allows you to examine the front element without removing it?
Which collection type uses a hash table internally and provides O(1) average lookup?
What does the Add() method return when adding a duplicate element to a HashSet<T>?
What is the space complexity of a HashSet<T> with n elements?
What does the Peek() method do in a Stack<T>?