Java MCQ – Collections – Part 2
This collection of Java Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “Java Collections”.
1. Collection ______________
A inherits the Collections class
B inherits the Iterable interface
C implements the Serializable interface
D implements the Traversable interface
2. Which implementation of Iterator can traverse a collection back and forth?
A Iterator
B ListIterator
C SetIterator
D MapIterator
3. The interface Comparable contains the method ___________
A toCompare
B compare
C compareTo
D compareWith
4. Collection is a(n) ____________
A interface
B class
C framework and interface
D framework and class
5. List, Set and Queue __________ Collection.
A inherit
B implement
C Both A and B are true
D None of the above
6. Which of the following interfaces maintains the order in which the elements are inserted?
A Set
B List
C Map
D All the answers are true
7. Which of the following is an outdated class but still in use?
A Arraylist
B Vector
C Hashtable
D Both B and C are true.
8. Which of the following Sets maintains the insertion order?
A HashSet
B TreeSet
C LinkedHashSet
D All the answers are true
9. Which class stores elements in ascending order?
A ArrayList
B HashSet
C TreeSet
D All the answers are true
10. Iterator and ListIterator can iterate through __________
A List
B Set
C Map
D All the answers are true