C# Programming - MCQ Practice Questions
C# (.NET) MCQs — OOP, collections, LINQ & exception handling.
290 questions | 100% Free
Which namespace in C# contains the collections like List<T>, Dictionary<K,V>, and Queue<T>?
What is the main difference between ArrayList and List<T> in C#?
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 method removes all elements from a collection in C#?
What is the time complexity of accessing an element by index in a List<T>?
Which collection maintains insertion order but uses a hash table for faster lookups?
What happens when you try to access an index beyond the Count in a List<T>?
Which interface must be implemented to use a collection in a foreach loop?
What is the difference between Stack<T>.Push() and Stack<T>.Pop()?
Consider: Dictionary<string, int> dict = new(); dict.Add("a", 1); dict.Add("a", 2); What happens?
Which collection should be used when you need sorted key-value pairs automatically?
In C# 2024-25, which LINQ method would you use to find all elements matching a condition in a List<T>?
What is the space complexity of a HashSet<T> with n elements storing unique values?
Consider: var result = list.OrderByDescending(x => x.Age).ThenBy(x => x.Name); What does this do?
What is the difference between ICollection<T> and IEnumerable<T> in terms of capabilities?
In a concurrent environment, which collection should be used instead of Dictionary<K,V> in C# 2024-25?
Which collection in C# maintains insertion order and allows duplicate elements?