Question 10
True or False? A TreeSet object can contain duplicate elements.
Question 11
True or False? A TreeSet object is not a SortedSet.
Question 12
True or False? A TreeSet object is a Collection.
Question 13
True or False? Because an object of the TreeSet class is a Collection , a reference to such an object can be passed to any method that requires an incoming parameter of type Collection . The receiving method can call any method on that reference that is declared in the Collection interface .
Question 14
True or False? The behavior of the fillIt method in Listing 1 is to add elements to the incoming Collection object without regard for the actual type of the object (the class from which the object was instantiated).
Question 15
True or False? In Listing 1 , a reference to an object of type Button (see the Java documentation) could be passed as a parameter to the fillIt method.
Question 16
True or False? In Listing 1 , the fillIt method can call the add method on the incoming object with confidence that the behavior of the add method will be appropriate for the specific type of object involved.
Question 17
True or False? In Listing 1 , when the fillIt method returns, the TreeSet object contains five elements.
Question 18
True or False? In Listing 1 , when the fillIt method returns, the TreeSet object contains four (not five) elements with no duplicates. Each element is a reference to an object of type Integer . Those references are maintained in such a way as to make them accessible in descending order, basedon the int values encapsulated in each of the Integer objects.
Question 19
True or False? The call to the iterator method on any Collection object returns an instance of a class that implements the Iterator interface.
Question 20
True or False? An Iterator object can be used to traverse a Collection object, gaining access to each element in order .
Question 21
True or False? The concept of in order means the same thing for all Collection objects.
Question 22
True or False?
The Iterator interface declares three methods:
- hasNext()
- next()
- remove()
Question 23
True or False? The Iterator object associated with a particular Collection object provides access to the contents of the collection in a very specific way.
Question 24
True or False? The while loop in the Worker class in Listing 1 traverses the collection
- accessing each of the object's elements in succession, and
- displaying the value encapsulated in the object referred to by each element.
Question 25
True or False? Listing 1 causes the following text to appear on the screen:
44321
Listings
- Listing 1 . Used with several different questions.
What is the meaning of the following two images?
These images were inserted here simply to insert some space between the questions and the answers to keep them from being visible on the screen at thesame time.
This image was also inserted for the purpose of inserting space between the questions and the answers.