
Oracle Upgrade to Java SE 7 Programmer (1Z0-805日本語版) - 1Z0-805日本語 Exam Questions
QUESTION NO: 1

public class DataCache {
private static final DataCache instance = new DataCache ();
public static DataCache getInstance () {
return instance;
}
}


public class DataCache {
private static final DataCache instance = new DataCache ();
public static DataCache getInstance () {
return instance;
}
}

Correct Answer: A
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 2

submit (Data) { if (Data.size < SMALL_ENOUGH) { _________(Data); // line X } else { List<Data> x = _________________(Data); // line Y for(Data d: x ______________(d); // line Z } }

Process, submit, and splitInHalf


submit (Data) { if (Data.size < SMALL_ENOUGH) { _________(Data); // line X } else { List<Data> x = _________________(Data); // line Y for(Data d: x ______________(d); // line Z } }

Process, submit, and splitInHalf

Correct Answer: B,C,F
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 3


Correct Answer: D,E
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 4

static void addContent () throws Exception {
Path path = Paths.get("D:\\company\\report.txt");
UserPrincipal owner = path.getFileSystem().getUserPrincipalLookupService().lookupPrincipalByName("Bob");
Files.setOwner(path, owner);
// insert code here - Line **
br.write("this is a text message ");
}
System.out.println("success");
}
Assume that the report.txt file exists.


static void addContent () throws Exception {
Path path = Paths.get("D:\\company\\report.txt");
UserPrincipal owner = path.getFileSystem().getUserPrincipalLookupService().lookupPrincipalByName("Bob");
Files.setOwner(path, owner);
// insert code here - Line **
br.write("this is a text message ");
}
System.out.println("success");
}
Assume that the report.txt file exists.

Correct Answer: D
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 5

public class MyGrades {
private final List<Integer> myGrades = new ArrayList<Integer>();
private final ReadWriteLock rwlock = new ReentrantReadWriteLock();
public void addGrade(Integer grade) {
// acquire _______ lock
myGrades.add(grade);
// release __________ lock
}
public void averageGrades() {
// acquire _______ lock Line ** double sum = 0;
int i = 0;
for (i = 0; i < myGrades.size(); i++) {
sum += myGrades.get(i);
}
// release __________ lock Line ***
System.out.println("The average is: " + sum/(i+1));
}
}


public class MyGrades {
private final List<Integer> myGrades = new ArrayList<Integer>();
private final ReadWriteLock rwlock = new ReentrantReadWriteLock();
public void addGrade(Integer grade) {
// acquire _______ lock
myGrades.add(grade);
// release __________ lock
}
public void averageGrades() {
// acquire _______ lock Line ** double sum = 0;
int i = 0;
for (i = 0; i < myGrades.size(); i++) {
sum += myGrades.get(i);
}
// release __________ lock Line ***
System.out.println("The average is: " + sum/(i+1));
}
}

Correct Answer: C
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 6


Correct Answer: A
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 7

*Item_ID, Integer: PK
*Item_name, Varchar (20)
*Price, Numeric (10, 2)
*Quan, Integer

public static void updatePrices{ // #1: missing line
Connection con) throws SQLException {
// #2: missing line
PreparedStatement updatePrices = con.prepareStatement (updatePricesString);
// #3: missing line { // #4: missing line updatePrices.executeUpdate(); } }


*Item_ID, Integer: PK
*Item_name, Varchar (20)
*Price, Numeric (10, 2)
*Quan, Integer

public static void updatePrices{ // #1: missing line
Connection con) throws SQLException {
// #2: missing line
PreparedStatement updatePrices = con.prepareStatement (updatePricesString);
// #3: missing line { // #4: missing line updatePrices.executeUpdate(); } }

Correct Answer: C
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 8

import java.util.*;
public class StringApp {
public static void main (String [] args) {
Set <String> set = new TreeSet <> ();
set.add("X");
set.add("Y");
set.add("X");
set.add("Y");
set.add("X");
Iterator <String> it = set.iterator ();
int count = 0;
while (it.hasNext()) {
switch (it.next()){
case "X":
System.out.print("X ");
break;
case "Y":
System.out.print("Y ");
break;
}
count++;
}
System.out.println ("\ncount = " + count);
}
}


import java.util.*;
public class StringApp {
public static void main (String [] args) {
Set <String> set = new TreeSet <> ();
set.add("X");
set.add("Y");
set.add("X");
set.add("Y");
set.add("X");
Iterator <String> it = set.iterator ();
int count = 0;
while (it.hasNext()) {
switch (it.next()){
case "X":
System.out.print("X ");
break;
case "Y":
System.out.print("Y ");
break;
}
count++;
}
System.out.println ("\ncount = " + count);
}
}

Correct Answer: A
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 9


Correct Answer: C,D
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).




