Which collection class associates values witch keys, and orders the keys according to their natural order ?
Correct answer: B. java.util.TreeMap
- A. java.util.LinkedList
- B. java.util.TreeMap
- C. java.util.SortedSet
- D. java.util.HashSet
Explanation
TreeMap stores key-value pairs and keeps its keys sorted according to their natural ordering, such as alphabetical or numeric order. LinkedList, HashSet, and SortedSet do not provide this key-to-value mapping.
Last updated
Practise Data Structures and Algorithms
21 free Data Structures and Algorithms MCQs from Software Engineering, each with the correct answer and an explanation. Unlimited attempts, no account needed.
Exams that ask Software Engineering questions like this
Software Engineering is on this paper prepared for on TestUstad, and all of them draw the same bank, so this question is worth knowing for it.
Related questions
A step by step instruction used to solve a problem is known as ___________________?
Which of the following is a common pointwer problem ?
Arithmatic operations _____________________________?
One nibble is equal to________________?
When 2 or more bits in a data unit has been changed during the transmission, the error is called___________________?