--:--









Quiz for HashSet vs TreeSet

Course: JAVA | Subject: Java | Topic: Java Collections Framework



Logo

Q1: Which collection maintains elements in sorted order?

Logo

Q2: Which has better performance for add, remove, and contains operations?

Logo

Q3: Which one allows null elements?

Logo

Q4: What is the time complexity of adding an element in HashSet?

Logo

Q5: What is the time complexity of adding an element in TreeSet?

Logo

Q6: Which collection requires elements to be Comparable or a Comparator to be provided?

Logo

Q7: Which class is faster when order of elements is not important?

Logo

Q8: Which class automatically removes duplicates?

Logo

Q9: Which class maintains insertion order?

Logo

Q10: Which is implemented using a Red-Black Tree?

Are you ready to start test? Set your time limit