Question 1
Which method of the Iterator interface removes the last element returned by the iterator?
delete()
remove()
clear()
discard()
Question 2
What happens if you modify a collection directly while iterating over it using a normal Iterator?
It updates automatically
Throws ConcurrentModificationException
Skips modified elements
The iterator restarts
Question 3
Which iterator type allows iteration in both directions in Java?
Iterator
Enumeration
CollectionIterator
ListIterator
Question 4
If a class implements Comparable, which method must it override?
equals(Object obj)
compareTo(Object o)
compare(Object o1, Object o2)
hashCode()
Question 5
Which statement is TRUE about Comparator in Java?
A comparator is used to define the natural ordering of objects.
Comparator is implemented inside the class itself.
Comparator can be used to define multiple sorting orders.
Comparator can only sort Strings.
Question 6
In Comparable, the compareTo() method should return:
Positive integer if current object is less than the specified object
Zero if current object is greater
Negative integer if current object is greater
Positive integer if current object is greater than the specified object
Question 7
Which class from java.util.concurrent allows a thread to safely wait for another thread's completion?
Semaphore
CountDownLatch
CyclicBarrier
All of the above
Question 8
Which concurrent collection is best suited for a producer-consumer scenario?
CopyOnWriteArrayList
ConcurrentHashMap
LinkedBlockingQueue
ConcurrentSkipListMap
Question 9
Which concurrent collection maintains elements in a sorted order?
ConcurrentHashMap
CopyOnWriteArrayList
ConcurrentSkipListSet
ConcurrentLinkedQueue
Question 10
Which concurrent collection is an unbounded thread-safe queue based on linked nodes that orders elements according to FIFO (First-In-First-Out)?
ConcurrentLinkedQueue
LinkedBlockingQueue
PriorityBlockingQueue
ArrayBlockingQueue
There are 10 questions to complete.