Question: You can use a for-each loop to traverse all elements in a container object that implements___ A. Iterator B. Collection C. Iterable D. ArrayList Suppose

You can use a for-each loop to traverse all elements in a container object that implements___ A. Iterator B. Collection C. Iterable D. ArrayList Suppose a list contains {"red", "green", "red", "green"}. What is the list after the following code? list remove ("red"); A. {"red", green "red, "green"} B. {"green", "red", "green"} C. {"green", "green"} D. {"red", green", "green"} Which of the following methods are in the Collection interface? A. clear() B. is Empty() C. size() D. getSize() The poll() method in the Queue interface___. A. retrieves and removes the head of this queue, or null if this queue is empty B. retrieves and removes the head of this queue and throws an exception if this queue is empty C. retrieves, but does not remove, the head of this queue, returning null if this queue is empty D. retrieves, but does not remove, the head of this queue, throwing an exception if this queue is empty The peek() method in the Queue interface___ A. retrieves and removes the head of this queue, or null if this queue is empty B. retrieves and removes the head of this queue and throws an exception if this queue is empty C. retrieves, but does not remove, the head of this queue, returning null if this queue is empty D. retrieves, but does not remove, the head of this queue, throwing an exception if this queue is empty You should use the ArrayList or LinkedList to store duplicate elements. True False Suppose list list1 is [1, 2, 5] and list list2 is [2, 3, 6]. After list1. addAll(list2), list1 is A. [1, 2, 2, 3, 5, 6] B. [1, 2, 3, 5, 6]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
