iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.1Easy

Which namespace in C# contains the collections like List<T>, Dictionary<K,V>, and Queue<T>?

Q.2Easy

What is the main difference between ArrayList and List<T> in C#?

Q.3Easy

Which collection allows duplicate keys in C#?

Q.4Easy

What does the Count property of a collection return in C#?

Q.5Easy

Which collection in C# implements LIFO (Last In First Out) principle?

Q.6Easy

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);

Q.7Medium

Which method removes all elements from a collection in C#?

Q.8Medium

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

Q.9Medium

Which collection maintains insertion order but uses a hash table for faster lookups?

Q.10Medium

What happens when you try to access an index beyond the Count in a List<T>?

Q.11Medium

Which interface must be implemented to use a collection in a foreach loop?

Q.12Medium

What is the difference between Stack<T>.Push() and Stack<T>.Pop()?

Q.13Medium

Consider: Dictionary<string, int> dict = new(); dict.Add("a", 1); dict.Add("a", 2); What happens?

Q.14Medium

Which collection should be used when you need sorted key-value pairs automatically?

Q.15Hard

In C# 2024-25, which LINQ method would you use to find all elements matching a condition in a List<T>?

Q.16Hard

What is the space complexity of a HashSet<T> with n elements storing unique values?

Q.17Hard

Consider: var result = list.OrderByDescending(x => x.Age).ThenBy(x => x.Name); What does this do?

Q.18Hard

What is the difference between ICollection<T> and IEnumerable<T> in terms of capabilities?

Q.19Hard

In a concurrent environment, which collection should be used instead of Dictionary<K,V> in C# 2024-25?

Q.20Easy

Which collection in C# maintains insertion order and allows duplicate elements?