Que- What is the worst case complexity of accessing an element in ArrayList?
a. O(n)
b. O(1)
c. O(nlogn)
d. O(2)
Answer- O(1)
Que- When an array is passed to a method, will the content of the array undergo changes with the actions carried within the function?
a.TRUE
b.FALSE
c.Nothing Can be Said
d.None of the mentioned
Answer-TRUE
Que- What is the default clone of HashSet?
a. Deep clone
b. Shallow clone
c. Plain clone
d. Hollow clone
Answer- Shallow clone
Que- Do we have get(Object o) method in HashSet.
a.TRUE
b.FALSE
c.Nothing Can be Said
d.None of the mentioned
Answer-FALSE
Que- What does Collections.emptySet() return?
a. Immutable Set
b. Mutable Set
c. The type of Set depends on the parameter passed to the emptySet() method
d. Null object
Answer- Immutable Set
Que- What are the initial capacity and load factor of HashSet?
a. 10, 1.0
b. 32, 0.75
c. 16, 0.75
d. 32, 1.0
Answer- 16, 0.75
Que- What is the relation between hashset and hashmap?
a. HashSet internally implements HashMap
b. HashMap internally implements HashSet
c. HashMap is the interface; HashSet is the concrete class
d. HashSet is the interface; HashMap is the concrete class
Answer- HashSet internally implements HashMap
Que- What is the difference between TreeSet and SortedSet?
a. TreeSet is more efficient than SortedSet
b. SortedSet is more efficient than TreeSet
c. TreeSet is an interface; SortedSet is a concrete class
d. SortedSet is an interface; TreeSet is a concrete class
Answer- SortedSet is an interface; TreeSet is a concrete class
Que- What happens if two threads simultaneously modify TreeSet?
a. ConcurrentModificationException is thrown
b. Both threads can perform action successfully
c. FailFastException is thrown
d. IteratorModificationException is thrown
Answer- ConcurrentModificationException is thrown
Que- What is the unique feature of LinkedHashSet?
a. It is not a valid class
b. It maintains the insertion order and guarantees uniqueness
c. It provides a way to store key values with uniqueness
d. The elements in the collection are linked to each other
Answer- It maintains the insertion order and guarantees uniqueness
Que- Which of these standard collection classes implements a linked list data structure?
a. AbstractList
b. LinkedList
c. HashSet
d. AbstractSet
Answer- LinkedList
Que- Which of these classes implements Set interface?
a. ArrayList
b. HashSet
c. LinkedList
d. DynamicList
Answer- HashSet
Que- Which of these method is used to add an element to the start of a LinkedList object?
a. add()
b. first()
c. AddFirst()
d. addFirst()
Answer- addFirst()
Que- Which of these method of HashSet class is used to add elements to its object?
a. add()
b. Add()
c. addFirst()
d. insert()
Answer- add()
Que- Which of these methods can be used to delete the last element in a LinkedList object?
a. remove()
b. delete()
c. removeLast()
d. deleteLast()
Answer- removeLast()
Que- Which of this method is used to change an element in a LinkedList Object?
a. change()
b. set()
c. redo()
d. add()
Answer- set()
Que- Which of these standard collection classes implements a linked list data structure?
a. AbstractList
b. LinkedList
c. HashSet
d. AbstractSet
Answer- LinkedList
Que- Which of these classes implements Set interface?
a. ArrayList
b. HashSet
c. LinkedList
d. DynamicList
Answer- HashSet
Que- Which of these method is used to add an element to the start of a LinkedList object?
a. add()
b. first()
c. AddFirst()
d. addFirst()
Answer- addFirst()
Que- Which of these method of HashSet class is used to add elements to its object?
a. add()
b. Add()
c. addFirst()
d. insert()
Answer- add()
Que- Which of these methods can be used to delete the last element in a LinkedList object?
a. remove()
b. delete()
c. removeLast()
d. deleteLast()
Answer- removeLast()
Que- Which of this method is used to change an element in a LinkedList Object?
a. change()
b. set()
c. redo()
d. add()
Answer- set()
Que- Which of these object stores association between keys and values?
a. Hash table
b. Map
c. Array
d. String
Answer- Map
Que- Which of these classes provide implementation of map interface?
a. ArrayList
b. HashMap
c. LinkedList
d. DynamicList
Answer- HashMap
Que- Which of these method is used to remove all keys/values pair from the invoking map?
a. delete()
b. remove()
c. clear()
d. removeAll()
Answer- remove()
Que- Which of these method Map class is used to obtain an element in the map having specified key?
a. search()
b. get()
c. set()
d. look()
Answer- get()
Que- Which of these methods can be used to obtain set of all keys in a map?
a. getAll()
b. getKeys()
c. keyall()
d. keySet()
Answer- keySet()
Que- Which of these method is used add an element and corresponding key to a map?
a. put()
b. set()
c. redo()
d. add()
Answer- put()