Java MCQ - Collections Framework
Mock java test, multiple-choice questions with answers on collections framework for self-assessment and evaluation. Java self-evaluation test for OCJP aspirants.
Java self-evaluation test
Topic- Collections framework in Java
The test consists of 13 questions.
No negative marking for this test.
No Time limit
The pass percentage is 70%
The correct answer with a description will be displayed after the answer has been marked.
Submit the test to calculate your score once you are done with all the questions.
Complexity Level- Medium
Q1: Select all the core collection interfaces
Q2: Select all the concrete classes that implement Set interface
Q3: Select all the correct statements about HashSet and LinkedHashSet
Q4: Select all the implementing classes of the List interface
Q5: Lists are collections that maintain elements in order
Select True or False
Q6: The List is a collection that contains only unique elements
Select True or False
Q7: Select all the implementing classes of the Map interface
Q8: A Map can contain duplicate keys
Select True or False
Q9: The changes made to the returned SortedSet by a headset(object toElement) method are reflected in the original SortedSet
Select True or False
Q10: Select the classes which have a comparator() method
Q11: Select the correct methods that can be called on objects implementing the Map interface
Q12: Select the correct output of the execution of the below program:
public static void main(String[] args) {
SortedSet ss=new TreeSet();
ss.add("a");
ss.add("b");
ss.add("c");
ss.add("d");
ss.add("e");
ss.add("f");
ss.add("g");
SortedSet ss2=ss.headSet("e");
Iterator ssitr2=ss2.iterator();
while(ssitr2.hasNext())
{
System.out.println(ssitr2.next().toString());
}
}
Q13: Select the correct output of the execution of the below program:
public static void main(String[] args) {
SortedSet ss=new TreeSet();
ss.add("a");
ss.add("b");
ss.add("c");
ss.add("d");
ss.add("e");
ss.add("f");
ss.add("g");
SortedSet ss2=ss.tailSet("e");
Iterator ssitr2=ss2.iterator();
while(ssitr2.hasNext())
{
System.out.println(ssitr2.next().toString());
}
}