

MCQOPTIONS
Saved Bookmarks
This section includes 10 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.
1. |
What is the unique feature of LinkedHashSet? |
A. | It is not a valid class |
B. | It maintains the insertion order and guarantees uniqueness |
C. | It provides a way to store key values with uniqueness |
D. | The elements in the collection are linked to each other |
Answer» C. It provides a way to store key values with uniqueness | |
2. |
What happens if two threads simultaneously modify TreeSet? |
A. | ConcurrentModificationException is thrown |
B. | Both threads can perform action successfully |
C. | FailFastException is thrown |
D. | IteratorModificationException is thrown |
Answer» B. Both threads can perform action successfully | |
3. |
What is the difference between TreeSet and SortedSet? |
A. | TreeSet is more efficient than SortedSet |
B. | SortedSet is more efficient than TreeSet |
C. | TreeSet is an interface; SortedSet is a concrete class |
D. | SortedSet is an interface; TreeSet is a concrete class |
Answer» E. | |
4. |
Set has contains(Object o) method. |
A. | True |
B. | False |
Answer» B. False | |
5. |
What does Collections.emptySet() return? |
A. | Immutable Set |
B. | Mutable Set |
C. | The type of Set depends on the parameter passed to the emptySet() method |
D. | Null object |
Answer» B. Mutable Set | |
6. |
What is the default clone of HashSet? |
A. | Deep clone |
B. | Shallow clone |
C. | Plain clone |
D. | Hollow clone |
Answer» C. Plain clone | |
7. |
WHAT_IS_THE_DIFFERENCE_BETWEEN_TREESET_AND_SORTEDSET??$ |
A. | TreeSet is more efficient than SortedSet |
B. | SortedSet is more efficient than TreeSet |
C. | TreeSet is an interface; SortedSet is a concrete class |
D. | SortedSet is an interface; TreeSet is a concrete class |
Answer» C. TreeSet is an interface; SortedSet is a concrete class | |
8. |
What is the relation between hashset and hashmap? |
A. | HashSet internally implements HashMap |
B. | HashMap internally implements HashSet |
C. | HashMap is the interface; HashSet is the concrete class |
D. | HashSet is the interface; HashMap is the concrete class |
Answer» B. HashMap internally implements HashSet | |
9. |
What are the initial capacity and load factor of HashSet? |
A. | 10, 1.0 |
B. | 32, 0.75 |
C. | 16, 0.75 |
D. | 32, 1.0 |
Answer» D. 32, 1.0 | |
10. |
Do we have get(Object o) method in HashSet. |
A. | True |
B. | False |
Answer» C. | |