List - Practice quiz
11. What is the purpose of the Java Collections Framework?
- To provide a set of classes and interfaces for working with collections of objects.
- To provide a set of classes and interfaces for working with input/output operations.
- To provide a set of classes and interfaces for working with threads and concurrency.
- To provide a set of classes and interfaces for working with graphical user interfaces (GUI).
12. Which of the following interfaces in Java Collections Framework extends the Collection interface and allows duplicate elements?
- List
- Set
- Map
- Queue
13. What is the main difference between ArrayList and Vector in Java?
- ArrayList is synchronized, while Vector is not.
- Vector is resizable, while ArrayList is not.
- ArrayList allows duplicate elements, while Vector does not.
- Vector is thread-safe, while ArrayList is not.
14. Which of the following is not a valid implementation of the List interface in Java Collections Framework?
- ArrayList
- LinkedList
- HashSet
- Vector
15. Which of the following classes in Java Collections Framework represents a last-in, first-out (LIFO) stack of objects?
- List
- Set
- Map
- Stack
Map - Practice Quiz
16. Which of the following Java Map implementations allows null keys and values, and does not maintain the insertion order of elements?
- HashMap
- Linked HashMap
- Weak HashMap
- EnumMap
17. Which of the following Java Map implementations maintains the insertion order of elements and allows null keys and values?
- LinkedHashMap
- TreeMap
- SortedMap Interface
- NavigableMap Interface
18. Which of the following Java Map implementations is a concurrent map that is designed to be used in multi-threaded environments and provides thread-safe operations without the need for external synchronization?
- HashMap
- TreeMap
- ConcurrentHashMap
- WeakHashMap
19. Which of the following Java Map implementations is a specialized map that uses weak references to keys, allowing the keys to be garbage collected if they are not used anywhere else in the program?
- HashMap
- LinkedHashMap
- WeakHashMap
- TreeMap
20. Which of the following Java Map implementations is a specialized map that is designed to be used with enum keys only?
- HashMap
- LinkedHashMap
- EnumMap
- TreeMap