iGET

C# Programming - MCQ Practice Questions

C# (.NET) MCQs — OOP, collections, LINQ & exception handling.

290 questions | 100% Free

Q.241Easy

What is the time complexity of accessing an element by index in List<T>?

Q.242Medium

Which collection type is best suited for implementing a priority queue in C#?

Q.243Medium

What happens when you add a duplicate key to a Dictionary<TKey, TValue>?

Q.244Medium

Which LINQ method returns the first element matching a condition, or throws if none exists?

Q.245Medium

What is the primary difference between SortedList<TKey, TValue> and SortedDictionary<TKey, TValue>?

Q.246Medium

Which collection in C# is NOT thread-safe by default?

Q.247Medium

What does the Contains() method use in HashSet<T> to determine membership?

Q.248Medium

Which of the following collections preserves insertion order and is thread-safe?

Q.249Medium

What is the time complexity for removing an element from the middle of a LinkedList<T>?

Q.250Easy

Which method in Stack<T> returns the top element without removing it?

Q.251Medium

In C# 2024-25, which collection should be used for fast membership testing with no duplicates?

Q.252Medium

What is the output of the following code? var dict = new Dictionary<int, string>(); dict[1] = "A"; dict[1] = "B"; Console.WriteLine(dict[1]);

Q.253Hard

Which collection type allows you to iterate in reverse order efficiently?

Q.254Hard

What happens when you call Clear() on a Dictionary<TKey, TValue>?

Q.255Hard

Which LINQ method should you use to get distinct elements from a List<int> while maintaining performance?

Q.256Hard

In a competitive exam scenario, if you need both fast lookup and sorted iteration, which should you choose?

Q.257Medium

Which collection in C# maintains insertion order and allows fast removal from both ends?

Q.258Easy

Which IEnumerable method should be used to filter elements based on a condition and maintain type safety?

Q.259Easy

In a HashSet<T>, what happens when you try to add a duplicate element?

Q.260Medium

Which collection type should be used when you need key-value pairs with guaranteed order of insertion?