No student devices needed. Know more
14 questions
-Contains no duplicate elements.
-Can contain at most one Null value.
-Elements are not key-value pairs.
-Accessing an element can be almost as fast as performing a similar operation on an array.
Which of these classes provides the specified features?
LinkedList
TreeMap
HashSet
LinkedHashMap
HashMap
Which of the following statement about Set is true?
A HashSet cannot have a null value.
Set allows duplicate values.
Set allows null values but only single occurrence.
Set extends the Java.util.collection interface.
-Entries are organized as key/value pairs.
-Duplicate entries replace old entries.
-Entries are sorted using a Comparator or the Comparable interface.
Which interface of the java.util package offers the specified behavior?
List
Map
Set
SortedSet
SortedMap
{1=C, 2=JavaEE, 4=Python, 3=PHP}
{1=C, 2=JavaSE, 3=Python, 4=PHP}
{1=C, 2=JavaEE, 3=Python, 4=PHP}
{1=C, 2=JavaSE,2=JavaEE, 3=Python, 4=PHP}
NullPointerException
{null=null, a=null, b=JavaSE, c=PHP, d=Python}
{a=null, b=JavaSE, c=PHP, d=Python}
{b=JavaSE, c=PHP, d=Python}
Compilation Fails
4
5
6
12
-Entries are not organized as key/value pairs.
-Duplicate entries are rejected.
Which interface of the java.util package offers the specified behavior?
List
Map
Set
None of the above
[Computer, Network, Networks, Programming, Security]
[Computer, Programming, Network, Networks, Programming, Security]
[Computer, Programming, Computer, Networks, Network, Security]
[Computer, Networks, Network, Programming, Security]
List listNames = new ArrayList();
listNames.add("Tom");
listNames.add("Mary");
listNames.add("Peter");
String name2 = (String) listNames.get(1);
System.out.println(name2);
What is the output of the above code
Tom
Mary
Peter
raises Exception
What is Collection in Java?
A group of objects
A group of classes
A group of interfaces
None of the mentioned
Which of these interface is not part of Java’s collection framework?
List
Sorted List
Set
Sorted Map
What will be the output of the Java program?
{0, 1, 3, 4}
{0, 1, 2, 4}
{0, 1, 2, 3, 4}
{0, 0, 0, 3, 4}
Which of these return type of hasNext() method of an iterator?
Integer
Double
Boolean
Collections Object
Which of these methods deletes all the elements from invoking collection?
clear();
reset();
delete();
remove();
Explore all questions with a free account