I need help wth this questions Can you answer if u are sure about it and explain
ID: 3806862 • Letter: I
Question
I need help wth this questions Can you answer if u are sure about it and explain the reason please!
1. A collection that allows items to be added only at one end and removed only at the other end is called a ____.
list
stack
set
queue
2. Which of the following statements about the LinkedList class is correct?
When you use the add method, the new element is inserted before the iterator, and the iterator position is advanced by one position.
When you use the add method, the new element is inserted after the iterator, and the iterator position is advanced by one position.
When you use the add method, the new element is inserted before the iterator, and the iterator position is not moved
When you use the add method, the new element is inserted after the iterator, and the iterator position is not moved.
3. A linear search only requires ____ access.
sequential
random
sorted
arbitrary
4. What is the meaning of the type parameter E, in the LinkedList<E> code fragment?
The elements of the linked list are of class E.
The elements of the linked list are of any subclass of class E.
The elements of the linked list are any type supplied to the constructor.
The elements of the linked list are of class Object.
5. You need to write a program to build and maintain an address book. Since the program must support the possibility of having duplicate names, which data structure would be most appropriate to model this situation?
map
stack
queue
linked list
6. You need to access values by an integer position. Which collection type should you use?
Map
Hashtable
ArrayList
Queue
7. Which data structure would best be used for storing a set of numbers and sorting them in ascending order?
queue
stack
list
array
list
stack
set
queue
Explanation / Answer
Question 1:
Answer: queue
A collection that allows items to be added only at one end and removed only at the other end is called a queue
Question 2:
Answer: When you use the add method, the new element is inserted after the iterator, and the iterator position is advanced by one position.
Question 3:
Answer:sequential
A linear search only requires _sequential___ access
Question 4:
Answer: The elements of the linked list are any type supplied to the constructor
Question 5:
Answer: linked list
Question 6:
Answer: ArrayList
Question 7:
Answer: list