最新的Oracle Upgrade to Java SE 7 Programmer - 1Z0-805免費考試真題

Given:

Which design pattern moves the getPerson, createPerson, deletePerson, and updatePerson methods to a new class?

正確答案: D
說明:(僅 Fast2test 成員可見)
Given the code fragment:
private static void copyContents (File source, File target) {
try {inputStream fis = new FileInputStream(source);
outputStream fos = new FileOutputStream (target);
byte [] buf = new byte [8192]; int i;
while ((i = fis.read(buf)) != -1) {
fos.write (buf, 0, i);
}
//insert code fragment here. Line **
System.out.println ("Successfully copied");
}
Which code fragments, when inserted independently at line **, enable the code to compile?

正確答案: A,C,E
說明:(僅 Fast2test 成員可見)
Given:
private static void copyContents() {
try (
InputStream fis = new FileInputStream("report1.txt");
OutputStream fos = new FileOutputStream("consolidate.txt");
) {
byte[] buf = new byte[8192];
int i;
while ((i = fis.read(buf)) != -1) {
fos.write(buf, 0, i);
}
fis.close();
fis = new FileInputStream("report2.txt");
while ((i = fis.read(buf)) != -1) {
fos.write(buf, 0, i);
}
}
What is the result?

正確答案: A
說明:(僅 Fast2test 成員可見)
Given the following code fragment:
public static void getInfo() {
//insert code here
List fontCatalog = new ArrayList();
fontCatalog.add("Algerian");
fontCatalog.add("Cambria");
fontCatalog.add("Lucida Bright");
category.put("firstCategory",fontCatalog);
List entrySet = new ArrayList(category.entrySet());
Iterator it = entrySet.iterator();
while(it.hasNext()) {
System.out.println(it.next));
}
}
Which two code fragments, when inserted independently at line **, enable the code to compile?

正確答案: B,D
說明:(僅 Fast2test 成員可見)
Given the code fragment:
Locale loc1 = Locale.getDefault ();
ResourceBundle messages = ResourceBundle.getBundle("MessageBundle", loc1);
Which two statements are a valid way to re-assign a resource bundle to a different Locale?

正確答案: A,D
The current working directory is named finance.
Which two code fragments allow you to write the salary.dat file if it does not exist under "finance\payroll"?

正確答案: A,D
說明:(僅 Fast2test 成員可見)
Given the code fragment:
public static void main(String[] args) {
String source = "d:\\company\\info.txt";
String dest = "d:\\company\\emp\\info.txt";
//insert code fragment here Line **
} catch (IOException e) {
System.err.println ("Caught IOException: " + e.getmessage();
}
}
Which two try statements, when inserted at line **, enable the code to successfully move the file info.txt to the destination directory, even if a file by the same name already exists in the destination directory?

正確答案: A,D
Given the code fragment:
public static void main(String[] args) {
Path file = Paths.get("D:\\company\\report.txt");
try (SeekableByteChannel sbc = Files.newByteChannel(file,new OpenOption[]
sbc.position(5);
sbc.truncate(30);
} catch (IOException e) {
System.err.printin("Caught IOException: " + e.getMessage () } ;
}
}
What is the result if the report.txt file contains
Welcome to the world of Java?

正確答案: D
說明:(僅 Fast2test 成員可見)
Given the following incorrect program:
class MyTask extends RecursiveTask<Integer> {
final int low;
final int high;
static final int THRESHOLD = /* . . . */
MyTask (int low, int high) { this.low = low; this.high = high; }
Integer computeDirectly()/* . . . */
protected void compute() {
if (high - low <= THRESHOLD)
return computeDirectly();
int mid = (low + high) / 2;
invokeAll(new MyTask(low, mid), new MyTask(mid, high));
Which two changes make the program work correctly?

正確答案: D,E
說明:(僅 Fast2test 成員可見)

聯系我們

如果您有任何問題,請留下您的電子郵件地址,我們將在12小時內回复電子郵件給您。

我們的工作時間:( GMT 0:00-15:00 )
週一至週六

技術支持: 立即聯繫 

English 日本語 Deutsch 한국어