iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.21Medium

What is the time complexity of the IndexOf() method in List<T>?

Q.22Medium

What is the primary advantage of using SortedList<K,V> over SortedDictionary<K,V>?

Q.23Medium

In C# 2024-25, which collection should be used for thread-safe operations without explicit locking?

Q.24Medium

What happens when you enumerate a Dictionary<K,V> during modification?

Q.25Medium

In a scenario with large datasets, which collection should you use to avoid boxing overhead?

Q.26Medium

Which method allows you to get an element from a SortedSet<T> at a specific index without using indexer?

Q.27Medium

What does TryDequeue() return in ConcurrentQueue<T> when the queue is empty?

Q.28Medium

Which scenario best uses Stack<T> instead of Queue<T> in a practical application?

Q.29Medium

In a scenario where you need to store key-value pairs with fast lookup times, which collection is optimal?

Q.30Medium

Which method should be used to safely check and retrieve a value from a Dictionary<K,V> without throwing an exception?

Q.31Medium

What is the primary difference between ArrayList and List<T>?

Q.32Medium

In a multiprocessing environment, which thread-safe collection should be used for concurrent operations?

Q.33Medium

What happens when you modify a List<T> while iterating over it using a foreach loop?

Q.34Medium

Which LINQ method is used to convert a Dictionary<K,V> to a List<T> of key-value pairs?

Q.35Medium

In a data processing pipeline, if you need FIFO (First-In-First-Out) semantics with O(1) enqueue/dequeue, which collection is best?

Q.36Medium

Which collection maintains elements in sorted order and is backed by a binary search tree?

Q.37Medium

What is the time complexity of Contains() method in a HashSet<T>?

Q.38Medium

In a scenario with frequent additions and removals at both ends, which collection is most efficient?