C# Programming - MCQ Practice Questions
C# (.NET) MCQs — OOP, collections, LINQ & exception handling.
290 questions | 100% Free
What is the time complexity of accessing an element by index in List<T>?
Which collection type is best suited for implementing a priority queue in C#?
What happens when you add a duplicate key to a Dictionary<TKey, TValue>?
Which LINQ method returns the first element matching a condition, or throws if none exists?
What is the primary difference between SortedList<TKey, TValue> and SortedDictionary<TKey, TValue>?
Which collection in C# is NOT thread-safe by default?
What does the Contains() method use in HashSet<T> to determine membership?
Which of the following collections preserves insertion order and is thread-safe?
What is the time complexity for removing an element from the middle of a LinkedList<T>?
Which method in Stack<T> returns the top element without removing it?
In C# 2024-25, which collection should be used for fast membership testing with no duplicates?
What is the output of the following code? var dict = new Dictionary<int, string>(); dict[1] = "A"; dict[1] = "B"; Console.WriteLine(dict[1]);
Which collection type allows you to iterate in reverse order efficiently?
What happens when you call Clear() on a Dictionary<TKey, TValue>?
Which LINQ method should you use to get distinct elements from a List<int> while maintaining performance?
In a competitive exam scenario, if you need both fast lookup and sorted iteration, which should you choose?
Which collection in C# maintains insertion order and allows fast removal from both ends?
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 collection type should be used when you need key-value pairs with guaranteed order of insertion?