MAP Java (GATE - CS)
Concept-based questions on Java Map interface and its implementations (HashMap, TreeMap, LinkedHashMap, ConcurrentHashMap, Hashtable) for GATE Computer Science preparation
Questions
Which of the following methods cannot be invoked with the object of TreeMap constructor?
- descendingMap()
- firstEntry()
- floorEntry(K key)
- headMap(K toKey)
- fixedMap()
Which of the following methods is present in Map interface in Java collections framework?
- containsKey(object)
- containValue(object)
- getKey(object)
- keysSet(object)
- removeKey(object)
How many constructors of HashMap class are there in Java collections framework?
- 6
- 5
- 4
- 3
- 2
Which of the following methods is not present in Map interface?
- putAll(map : m)
- Get(key : K)
- isEmpty()
- removeLast()
- put(Key : K, Value : V)
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
How many constructors of HashTable class are there in Java collections framework?
- 6
- 5
- 4
- 3
- 2
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)
How many constructors of TreeMap 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 the above
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
Which of the following methods is present in Map interface in Java collections framework?
- getKey()
- getValue()
- setValue(Value : V)
- keyset()
- getKeys()