C# - Collection Classes Questions and Answers
C# Collection Classes questions with answers are highly useful for mastering data storage and manipulation techniques in programming. Topics like Lists, Dictionaries, Queues, and HashSets are frequently tested in programming interviews and coding assessments. Practicing programming questions and answers with explanations helps students improve their understanding of C# data structures and performance optimization. Such programming MCQs and problem-based aptitude questions are commonly asked in technical interviews and placement tests conducted by companies like Microsoft, TCS, and Infosys. Strengthen your skills through C# programming test practice and learn to use collections efficiently.
Questions on data collections in C language. Broaden skills with arrays and pointers
C# - Collection Classes
21. Which collection does not allow duplicate keys
- List
- ArrayList
- Explanation: Dictionary requires unique keys.
- Queue
22. Which collection is non-generic and stores data as object
- List<T>
- Dictionary<T,K>
- Explanation: ArrayList stores all elements as object type.
- LinkedList<T>
23. Which collection provides fast lookup using keys
- Stack
- Queue
- Explanation: Dictionary provides fast key-based access.
- List
24. Which class represents a collection of objects sorted by key
- Hashtable
- Explanation: SortedList stores key-value pairs in sorted order.
- Stack
- Queue
25. Which collection allows duplicate values but unique keys
- List
- Explanation: Dictionary allows duplicate values but keys must be unique.
- Queue
- Stack
26. Which method is used to add an element to List<T>
- Insert()
- Explanation: Add() is used to insert elements into List<T>.
- Push()
- Enqueue()
27. Which method removes the top element of a Stack
- Remove()
- Delete()
- Explanation: Pop() removes and returns the top element.
- Clear()
28. Which method adds an element to a Queue
- Push()
- Add()
- Explanation: Enqueue() adds an element to a Queue.
- Insert()
29. Which collection allows indexed access
- Queue
- Stack
- Explanation: List allows access using index positions.
- Dictionary
30. Which collection stores elements as nodes with links
- ArrayList
- List
- Explanation: LinkedList stores elements as linked nodes.
- Dictionary