In Iterator, hasMoreElements() method of Enumeration has been changed to:
Anonymous Quiz
16%
hasNextElement()
11%
isNext()
63%
hasNext()
11%
name remains same
TreeSet internally uses that one to store elements?
Anonymous Quiz
27%
HashMap
23%
LinkedHashMap
50%
TreeMap
An attempt to add the null key to a TreeSet will result in:
Anonymous Quiz
16%
Will compile
53%
Compile time Exception
11%
Error
21%
Runtime - NullPointerException
TreeSet maintains which order?
Anonymous Quiz
57%
Ascending Order
19%
Descending Order
24%
None of the above
Enumeration returned by ArrayList is
Anonymous Quiz
43%
Fail-fast
48%
Fail-safe
10%
None of the above
How are you able to sort given HashMap on basis of values
Anonymous Quiz
21%
Implement Comparator interface and override its compare method
14%
It is not possible
57%
Implement Comparator interface and override its compareTo method
7%
Implement Comparator and Comparable interface
The Comparator interface contains the method?
Anonymous Quiz
27%
compareWith()
45%
compareTo()
27%
compare()
What will Collections.sort internally uses when number of elements are less than 7?
Anonymous Quiz
28%
Insertion sort
22%
Merge sort
50%
Quick sort
What do Collections.sort internally uses once a number of elements are greater than 7?
Anonymous Quiz
22%
Insertion sort
44%
Merge sort
33%
Quick sort
An attempt to add null key to a TreeMap will result in:
Anonymous Quiz
22%
Compile time Exception
17%
Error
61%
Runtime - NullPointerException
What will be the output of the following code -
import java.util.Map;
import java.util.TreeMap;
public class TreeMapTest
{
public static void main(String[] args) {
Map<Integer,String> m=new TreeMap<Integer,String>();
m.put(11,"audi");
m.put(null,null);
m.put(11,"bmw");
m.put(null,"fer");
System.out.println(m.size());
System.out.println(m);
}
}
import java.util.Map;
import java.util.TreeMap;
public class TreeMapTest
{
public static void main(String[] args) {
Map<Integer,String> m=new TreeMap<Integer,String>();
m.put(11,"audi");
m.put(null,null);
m.put(11,"bmw");
m.put(null,"fer");
System.out.println(m.size());
System.out.println(m);
}
}
Which of those is synchronized and does not allow null elements?
Anonymous Quiz
48%
Vector
14%
CopyOnWriteArraySet
19%
CopyOnWriteArrayList
19%
ConcurrentSkipListSet
Which of these is synchronised and isn't sorted by natural order?
Anonymous Quiz
17%
EnumSet
33%
LinkedList
21%
ConcurrentSkipListSet
29%
Vector