<< Chapter < Page | Chapter >> Page > |
Revised: Thu Apr 07 12:07:06 CDT 2016
This page is included in the following Books:
This module is one in a collection of modules on Java Collections designed for teaching ITSE2321 - Object-Oriented Programming (Java) at Austin Community College in Austin, TX.
This module contains review questions and answers keyed to the module titled Java4110: The Comparator Interface, Part 3 .
Once you study that module, you should be able to answer the review questions in this module.
The questions and the answers in this module are connected by hyperlinks to make it easy for you to navigate from the question to the answer and back again.
What output is produced by the program shown in Listing 1 ?
True or False? The fillIt method in Listing 1 populates the TreeSet object referred by the incoming parameter with the following names in the following order:
Joe Bill Tom JOE BILL TOM
True or False? When the fillIt method in Listing 1 returns, the TreeSet object is populated with six names in descending order taking case into account.
True or False? In the output from Listing 1 , descending order means that names beginning with letters that are low in the alphabet occur before names beginning with letters that arehigher in the alphabet. In addition, names containing lower case characters appear before the same names containing only upper case characters.
True or False? In Listing 1 , names with the same spelling but different case were considered to be duplicates and therefore wereexcluded from the collection
True or False? Given: Listing 1 contains the following statement:
return result*(-1);
If you were to change the value in parentheses from -1 to -2, the program output would be:
BILL Bill JOE Joe TOM Tom
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.
False. If you were to change the value in parentheses from -1 to -2, the program output would still be:
Tom TOM Joe JOE Bill BILL
It is the sign of the result and not the value of the result that determines the sorting order of the output in Listing 1 . You would need to multiply by a positive value to cause the output to be
BILL Bill JOE Joe TOM Tom
False. In Listing 1 , names with the same spelling but different case were not considered to be duplicates insofar as the contractfor the set was concerned.
Notification Switch
Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?