Index-based Input/Output — in which of the following .NET collections are elements accessed by index?

C# Programming Collection Classes Difficulty: Easy
Choose an option
  • A
    Stack and Queue
  • B
    BitArray and ArrayList
  • C
    HashTable only
  • D
    Stack, Queue, and HashTable
  • E
    All of the above

Answer

Correct Answer: BitArray and ArrayList

Explanation

Introduction / Context:Different collection types expose different access patterns (index, key, FIFO, LIFO). This affects algorithm design and complexity.

Concept / Approach:ArrayList and BitArray are index-based. Stack (LIFO) and Queue (FIFO) do not expose random indexers. HashTable is key-based, not index-based.

Why Other Options Are Wrong:Options including Stack/Queue/HashTable imply index-based access where none exists.

Final Answer:BitArray and ArrayList

Discussion & Comments
No comments yet. Be the first to comment!
Join Discussion