Answer saved
Marked out of 1.00
Flag question
Question text
Which of the following statements are true?
Select one or more:
a. The Collection interface is the root interface for manipulating a collection of objects.
b. The Collection interface provides the basic operations for adding and removing elements in
a collection.
c. The AbstractCollection class is a convenience class that provides partial implementation for
the Collection interface.
d. Some of the methods in the Collection interface cannot be implemented in the concrete
subclass. In this case, the method would throw java.lang.UnsupportedOperationException, a
subclass of RuntimeException.
e. All interfaces and classes in the Collections framework are declared using generic type in JDK
1.5.
Question 2
Answer saved
Marked out of 1.00
Flag question
Question text
Which of the following statements are true?
Select one or more:
a. Dialog boxes are defined by subclasses of the class JDialog.
b. The main difference between JDialogs and JFrames is that a dialog box has a parent, which if
closed, causes the dialog box to closes, too.
,c. When a modeless dialog is put up on the screen, the rest of the application is blocked until
the dialog box is dismissed.
d. Modal dialog boxes are like independent windows, since they can stay on the screen while
the user interacts with other windows.
Question 3
Answer saved
Marked out of 1.00
Flag question
Question text
What code is missing to complete the following method for sorting a list?
public static void sort(double[] list) {
___________________________;
}
public static void sort(double[] list, int high) {
if (high > 1) {
// Find the largest number and its index
int indexOfMax = 0;
double max = list[0];
for (int i = 1; i <= high; i++) {
if (list[i] > max) {
max = list[i];
indexOfMax = i;
}
}
// Swap the largest with the last number in the list
list[indexOfMax] = list[high];
list[high] = max;
// Sort the remaining list
sort(list, high - 1);
}
}
Select one:
, a. sort(list)
b. sort(list, list.length)
c. sort(list, list.length - 1)
d. sort(list, list.length - 2)
Clear my choice
Question 4
Answer saved
Marked out of 1.00
Flag question
Question text
What does this code do?
import java.io.*;
// (TextReader.class must be available to this program.)
public class TenLinesWithTextReader {
public static void main(String[] args) {
try {
TextReader in = new TextReader( new FileReader(args[0]) );
for (int lineCt = 0; lineCt < 10; lineCt++)) {
String line = in.getln();
System.out.println(line);
}
}
catch (Exception e) {
System.out.println("Error: " + e);
}
}
} // end class TenLinesWithTextReader
Select one:
a. This code accesses a remote computer and requests 10 HTML pages.
b. This code displays the first ten lines from a text file. The lines are written to standard output.