Question: QUESTION 1 The ArrayList class implements the ____. Queue interface. Set interface. List interface. Stack interface. QUESTION 2 Assume that you have declared a map
QUESTION 1
The ArrayList class implements the ____.
| Queue interface. | ||
| Set interface. | ||
| List interface. | ||
| Stack interface. |
QUESTION 2
Assume that you have declared a map named myMap to hold String elements with Integer keys. Which of the following statements will correctly remove an element from myMap?
| myMap.get(3); | ||
| myMap.remove(3); | ||
| myMap.pop(3); | ||
| myMap.delete(3); |
QUESTION 3
Which of the following statements about manipulating objects in a map is NOT correct?
| Use the add method to add a new element to the map. | ||
| Use the get method to retrieve a value from the map. | ||
| Use the keyset method to get the set of keys for the map. | ||
| Use the remove method to remove a value from the map. |
QUESTION 4
You use a(n) ____ to access elements inside a linked list.
| accessor | ||
| index | ||
| list iterator | ||
| queue |
QUESTION 5
We might choose to use a linked list over an array list when we will not require frequent ____.
I random access
II inserting new elements
III removing of elements
| I | ||
| II | ||
| III | ||
| II and III |
QUESTION 6
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 |
QUESTION 7
You need to access values by an integer position. Which collection type should you use?
| Map | ||
| Hashtable | ||
| ArrayList | ||
| Queue |
QUESTION 8
A collection without an intrinsic order is called a ____.
| list | ||
| stack | ||
| set | ||
| queue |
QUESTION 9
A stack is a collection that ____.
| remembers the order of elements, and allows elements to be added and removed only at one end. | ||
| does not remember the order of elements but allows elements to be added in any position. | ||
| remembers the order of elements and allows elements to be inserted in any position. | ||
| remembers the order of elements and allows elements to be inserted only at one end and removed only at the other end. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
