Question 1
Which of the following classes implement the List interface in Java?
HashMap
HashSet
ArrayList
TreeMap
Question 2
Which class among ArrayList, LinkedList, Vector, and Stack is synchronized (thread-safe)?
ArrayList
LinkedList
Vector
None of the above
Question 3
What is the time complexity of inserting an element at the beginning of an ArrayList?
O(1)
O(n)
O(log n)
O(n log n)
Question 4
Which data structure is best for implementing a LIFO (Last In First Out) operation in Java?
Queue
Stack
LinkedList
PriorityQueue
Question 5
Which of the following allows fast insertions and deletions at both ends?
ArrayList
LinkedList
Vector
Stack
Question 6
What happens if you try to access an invalid index in an ArrayList?
It returns null
It throws ArrayIndexOutOfBoundsException
It throws NullPointerException
It throws IndexOutOfBoundsException
Question 7
How do you retrieve the top element from a Stack without removing it?
pop()
peek()
top()
get()
Question 8
Which collection should you prefer when frequent insertions and deletions are required in the middle of the list?
ArrayList
Vector
LinkedList
Stack
Question 9
Which collection type does NOT allow random access to its elements?
ArrayList
HashSet
LinkedList
TreeSet
There are 9 questions to complete.