C#.NET collections — Which of the following types are present in the System.Collections.Generic namespace? 1) Stack 2) Tree 3) SortedDictionary 4) SortedArray
-
A1 and 2 only
-
B2 and 4 only
-
C1 and 3 only
-
DAll of the above
-
ENone of the above
Answer
Correct Answer: 1 and 3 only
Explanation
Introduction / Context:The System.Collections.Generic namespace provides strongly typed collections. Knowing what types actually exist there is a common interview and exam topic.
Given Data / Assumptions:
- We compare four names: Stack, Tree, SortedDictionary, SortedArray.
- We focus on generic collections.
Concept / Approach:System.Collections.Generic includes Stack
Step-by-Step Solution:
Identify known types: StackVerification / Alternative check:Browse the namespace reference listing; you will also see List
Why Other Options Are Wrong:They include types that are not part of the namespace.
Common Pitfalls:Assuming “Tree” exists because many data structures use trees internally. The BCL exposes dictionaries and sorted lists, not a raw tree interface.
Final Answer:1 and 3 only