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.7Easy

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

Q.8Easy

Which collection throws an exception when you try to dequeue from an empty Queue<T>?

Q.9Easy

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

Q.10Easy

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

Q.11Easy

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

Q.12Easy

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

Q.13Easy

Which LINQ method should you use to transform each element of a collection into a new form?

Q.14Easy

Which method in Queue<T> allows you to examine the front element without removing it?

Q.15Easy

Which collection type uses a hash table internally and provides O(1) average lookup?

Q.16Easy

What does the Add() method return when adding a duplicate element to a HashSet<T>?

Q.17Easy

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

Q.18Easy

What does the Peek() method do in a Stack<T>?