Loading

Q1.

Which of the following statements about HashMap is correct?

A. It allows duplicate keys

B. It allows one null key and multiple null values

C. It maintains insertion order

D. It is synchronized by default


Q2.

What happens when two keys in a HashMap have the same hash code?

A. One key is removed

B. It throws an exception

C. A collision occurs, handled by a linked list / tree

D. Both keys are stored without issue


Q3.

 Which data structure is used internally by HashMap?

A. ArrayList

B. Hashtable

C. Array + LinkedList / Tree (for collisions)

D. TreeMap


Q4.

Which of the following is NOT true about HashMap?

A. It is not synchronized by default

B. It provides constant-time performance for get/put in average case

C. It maintains keys in ascending order

D. It allows one null key


Q5.

What is the default initial capacity of a HashMap?

A. 8
B. 16
C. 32
D. 64