Framework Class Library (FCL) collections — pick the correct statement about performance and mutability of elements stored in collection classes.
-
AElements of a collection cannot be transmitted over a network.
-
BElements stored in a collection can be retrieved but cannot be modified.
-
CIt is not easy to adapt existing collection classes for new types of objects.
-
DElements stored in a collection can be modified only if all elements are of similar types.
-
EFCL collection classes use efficient algorithms and data structures to manage items, which helps program performance.
Answer
Correct Answer: FCL collection classes use efficient algorithms and data structures to manage items, which helps program performance.
Explanation
Introduction / Context:The .NET Framework Class Library (FCL) provides rich collection classes designed for common scenarios. This question checks conceptual understanding of their goals and capabilities.
Given Data / Assumptions:
- We are discussing the general properties of FCL collections (System.Collections and System.Collections.Generic).
- Statements concern mutability, transport, and performance characteristics.
Concept / Approach:Collections abstract storage and access patterns and are optimized for typical operations such as adding, searching, sorting, and enumerating. They can hold references to any serializable objects for transport, support modifying elements (subject to type rules), and use well-known data structures to improve performance.
Step-by-Step Solution:
1) Option A: Incorrect. Serializable elements in a collection can be transmitted over a network (e.g., via serialization or web APIs).2) Option B: Incorrect. Collections typically allow modification unless explicitly read-only wrappers are applied.3) Option C: Incorrect. Collections are designed to be widely applicable, and generics make adopting for new types straightforward.4) Option D: Incorrect. Heterogeneous collections are allowed; modification is not restricted to homogeneous element types (though generics encourage strong typing).5) Option E: Correct. FCL collections implement efficient algorithms and data structures to manage items effectively.Verification / Alternative check:Review types such as List<T>, Dictionary<TKey,TValue>, and HashSet<T> to see algorithmic choices (dynamic arrays, hash tables, trees).
Why Other Options Are Wrong:They impose artificial restrictions not inherent to FCL collections.
Common Pitfalls:Confusing read-only views with fundamental collection immutability; assuming only homogeneous types are supported.
Final Answer:FCL collection classes use efficient algorithms and data structures to manage items, which helps program performance.