PrepAway - Latest Free Exam Questions & Answers

What should you use to create the collection?

Domain.com has been hired by a small local private school to develop a class library that will be used in an application named ManageAttendance for the purpose of managing student records.
You are responsible for developing this class library. Domain.com has instructed you to create a collection in the application to store learners’ results.
The school has informed you that they currently only have seven learners, but that this value will triple in the following year.
Due to the limited resources, you need to ensure that the collection you create consumes a minimum amount of resources.
What should you use to create the collection?

PrepAway - Latest Free Exam Questions & Answers

A.
The HybridDictionary collection class.

B.
The HashTable collection class.

C.
The ListDictionary collection class.

D.
The StringCollection collection class.

Explanation:
You should use the HybridDictionary class to create the collection because this class is useful in scenarios where the number of elements is unknown or could grow in size. A collection of the HybridDictionary type manages the collection depending on the number of elements. The HybridDictionary type collection uses the ListDictionary class to manage the collection when there are only a few elements. When the number of elements exceeds ten, the HybridDictionary type collection automatically converts the elements into HashTable management.
Incorrect Answers:
B: You should not use this collection class because this class is used if the total number of elements to be stored in a collection is known and is greater than ten elements in length.
C: You should not use this collection class because this class is used if the total number of elements to be stored in a collection is known and is less than ten elements in length.
D: You should not use this collection class because this class is used to manage a collection of string values.

One Comment on “What should you use to create the collection?


Leave a Reply