Java MCQ's on Internal Working of HashMaps
This test contains 10 questions based on Internal Working of the HashMap.
Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers.
Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers.
Select Test Type
You Get +1 for each correct answer and -0.25 for each incorrect answer
Time Left -
minutes
:
seconds
How are key values stored in a hashmap ?
as Entry object | as a LinkedList |
as an ArrayList | None of these |
What is the initial size of a HashMap when we create an object of a HashMap ?
0 | 8 |
16 | None of these |
What methods are used to find the correct value of a given key ?
hashCode() | equals() |
both hashCode() and equals() | None of these |
How many times the key gets hashed while finding the correct location for saving the key value pair ?
2 | 1 |
4 | 3 |
Output of a HashMap is ordered ?
True | False |
What is the default load factor of a HashMap ?
1 | 0.5 |
0.75 | 0.25 |
How are keys-values saved when the keys produce the same hashcode ?
as a linkedlist | as an array |
as seperate objects | as vectors |
Which interface does a HashMap implement ?
NavigableMap | SortedMap |
Map | HashTable |
Is a HashMap threadsafe ?
Yes | No |
Depends | None of these |
Which of the following are correct for a HashMap and a HashTable ?
HashMap allows a null object but a HashTable does not. | Hashtable is threadsafe but a hashmap is not |
HashTable uses enumeration to iterate while a HashMap uses iterator to iterate. | All of the above |
Finish Test
No comments: