Java Collections Framework
Questions about Java Collections Framework classes, interfaces, constructors, and methods
Questions
Which of the following methods cannot be invoked with the object of ConcurrentHashMap class?
- putIfAbsent(K key, V value)
- replace(K key, V oldValue, V newValue)
- replace(K key, V value)
- containsValue(Object value)
- None of these
Which of the following methods cannot be invoked with the Object of TreeMap Constructor?
- descendingMap()
- firstEntry()
- floorEntry(K key)
- headMap(K toKey)
- fixedMap()
How many constructors of HashTable Class are there in java collections framework?
- 6
- 5
- 4
- 3
- 2
Which of the following methods can be invoked from the object of TreeMap Constructor?
- higherEntry(K key)
- pollLastEntry()
- descendingKeySet()
- Both (1) and (3)
- All of these
Which of the following methods is present in the PriorityQueue class in Java?
- poll()
- offer(E e)
- contains(Object o)
- Both (1) and (2)
- All of these
How many constructors of TreeMap are there in java collections framework?
- 6
- 5
- 4
- 3
- 2
Which of the following methods is/are present in the Vector class?
- copyInto(array : Object[])
- removeFirst()
- lastIndexOf(element :e)
- addLast(object)
- Set(int index, element e)
Which of the following methods is not present in the map interface in java collections framework?
- containsKey(object)
- containsValue(object)
- Get(key : K)
- Put(key : K, Value : V)
- setValue(Value : V)
Which of the following methods are not present in Collection interface?
- retainAll(Collection<!--?--> c)
- containsAll(Collection<!--?--> c)
- toArray(T[] a)
- firstEntry()
- equals(Object o)
Which of the following methods is present in map interface in java collections framework?
- getKey()
- getValue()
- setValue(Value : V)
- keyset()
- getKeys()
How many constructors of ConcurrentHashMap class are there in java collections framework?
- 8
- 7
- 6
- 5
- 4
How many constructors of LinkedHashMap class are there in java collections framework?
- 6
- 5
- 4
- 3
- 2
How many constructors of HashMap class are there in java collections framework?
- 6
- 5
- 4
- 3
- 2
Which of the following methods is present in map interface in java collections framework?
- boolean containsKey(object)
- containValue(object)
- getKey(object)
- KeysSet(object)
- removeKey(object)
Which of the following methods are not present in Map interface?
- putAll(map : m)
- Get(key : K)
- isEmpty()
- removeLast()
- Put(key : K, Value : V)