C# - Collection Classes Questions and Answers

Practice Mode
Showing 10 of 39 questions
Q11
Which of the following is an ordered collection class?     Map     Stack     Queue     BitArray     HashTable
  • A 1 only
  • B 2 and 3 only
  • C 4 and 5 only
  • D All of the above
Answer: Option B
Q12
Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr?
  • A arr.Count
  • B arr.GrowSize
  • C arr.MaxIndex
  • D arr.Capacity
Answer: Option A
Q13
Which of the following statements are correct about a HashTable collection?     It is a keyed collection.     It is a ordered collection.     It is an indexed collection.     It implements a IDictionaryEnumerator interface in its inner class.     The key - value pairs present in a HashTable can be accessed using the Keys and Values properties of the inner class that implements the IDictionaryEnumerator interface.
  • A 1 and 2 only
  • B 1, 2 and 3 only
  • C 4 and 5 only
  • D 1, 4 and 5 only
Answer: Option D
Q14
Which of the following statements are correct about the Collection Classes available in Framework Class Library?
  • A Elements of a collection cannot be transmitted over a network.
  • B Elements stored in a collection can be retrieved but cannot be modified.
  • C It is not easy to adopt the existing Collection classes for newtype of objects.
  • D Elements stored in a collection can be modified only if allelements are of similar types.
Answer: Option
Q15
Which C# collection allows dynamic resizing and stores elements as objects
  • A Array
  • B Explanation: ArrayList can grow or shrink dynamically and stores elements as object type.
  • C Stack
  • D Queue
Answer: Option B
Explanation: ArrayList can grow or shrink dynamically and stores elements as object type.
Q16
Which namespace contains most of the generic collection classes in C#
  • A System
  • B System.IO
  • C Explanation: Generic collections like List<T> and Dictionary<T,K> are in System.Collections.Generic.
  • D System.Linq
Answer: Option C
Explanation: Generic collections like List<T> and Dictionary<T,K> are in System.Collections.Generic.
Q17
Which collection stores elements in key-value pairs
  • A List
  • B Stack
  • C Explanation: Dictionary stores data as key and value pairs.
  • D Queue
Answer: Option C
Explanation: Dictionary stores data as key and value pairs.
Q18
Which collection follows Last In First Out principle
  • A Queue
  • B List
  • C Explanation: Stack works on LIFO principle.
  • D Hashtable
Answer: Option C
Explanation: Stack works on LIFO principle.
Q19
Which collection follows First In First Out principle
  • A Stack
  • B Explanation: Queue works on FIFO principle.
  • C Dictionary
  • D ArrayList
Answer: Option B
Explanation: Queue works on FIFO principle.
Q20
Which generic collection is type-safe
  • A ArrayList
  • B Hashtable
  • C Explanation: List<T> ensures type safety using generics.
  • D Stack
Answer: Option C
Explanation: List<T> ensures type safety using generics.
Questions and Answers for Competitive Exams Various Entrance Test