Programming in C# — Question 94
You are developing an application that includes a class named Order. The application will store a collection of Order objects.
The collection must meet the following requirements:
✑ Use strongly typed members.
✑ Process Order objects in first-in-first-out order.
✑ Store values for each Order object.
✑ Use zero-based indices.
You need to use a collection type that meets the requirements.
Which collection type should you use?
Answer options
- A. Queue<T>
- B. SortedList
- C. LinkedList<T>
- D. HashTable
- E. Array<T>
Correct answer: A
Explanation
The correct answer is A, Queue<T>, because it is designed for first-in-first-out processing, meeting the requirement for order. The other options either do not support FIFO (like SortedList and HashTable) or do not provide the necessary functionality for this specific use case (like LinkedList<T> and Array<T>).