Oracle Java SE 8 Programmer II (1z0-809日本語版) (1z0-809日本語) Free Practice Test
Question 1
Given:
Item table
ID, INTEGER: PK
DESCRIP, VARCHAR(100)
PRICE, REAL
QUANTITY< INTEGER
And given the code fragment:
9. try {
10.Connection conn = DriveManager.getConnection(dbURL, username,
password);
11. String query = "Select * FROM Item WHERE ID = 110";
12. Statement stmt = conn.createStatement();
13. ResultSet rs = stmt.executeQuery(query);
14.while(rs.next()) {
15.System.out.println("ID:" + rs.getInt("Id"));
16.System.out.println("Description:" + rs.getString("Descrip"));
17.System.out.println("Price:" + rs.getDouble("Price"));
18. System.out.println(Quantity:" + rs.getInt("Quantity"));
19.}
20. } catch (SQLException se) {
21. System.out.println("Error");
22. }
Assume that:
- The required database driver is configured in the classpath.
- The appropriate database is accessible with the dbURL, userName, and
passWord exists.
- The SQL query is valid.
What is the result?
Item table
ID, INTEGER: PK
DESCRIP, VARCHAR(100)
PRICE, REAL
QUANTITY< INTEGER
And given the code fragment:
9. try {
10.Connection conn = DriveManager.getConnection(dbURL, username,
password);
11. String query = "Select * FROM Item WHERE ID = 110";
12. Statement stmt = conn.createStatement();
13. ResultSet rs = stmt.executeQuery(query);
14.while(rs.next()) {
15.System.out.println("ID:" + rs.getInt("Id"));
16.System.out.println("Description:" + rs.getString("Descrip"));
17.System.out.println("Price:" + rs.getDouble("Price"));
18. System.out.println(Quantity:" + rs.getInt("Quantity"));
19.}
20. } catch (SQLException se) {
21. System.out.println("Error");
22. }
Assume that:
- The required database driver is configured in the classpath.
- The appropriate database is accessible with the dbURL, userName, and
passWord exists.
- The SQL query is valid.
What is the result?
Correct Answer: A
Question 2
コードの断片を考えると:
Map<Integer, String> books = new TreeMap<>();
books.put (1007, "A");
books.put (1002, "C");
books.put (1003, "B");
books.put (1003, "B");
System.out.println (books);
結果は何ですか?
Map<Integer, String> books = new TreeMap<>();
books.put (1007, "A");
books.put (1002, "C");
books.put (1003, "B");
books.put (1003, "B");
System.out.println (books);
結果は何ですか?
Correct Answer: A
Question 3
与えられた条件:

結果はどうなりましたか?

結果はどうなりましたか?
Correct Answer: A
Question 4
Bookクラスの定義を考えると:

Bookクラスについて正しい記述はどれですか?

Bookクラスについて正しい記述はどれですか?
Correct Answer: D
Question 5
Given:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
public void doRegister(String name, int age)
throws UserException, AgeOutOfLimitException {
if (name.length () < 6) {
throw new UserException ();
} else if (age >= 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println("User is registered.");
}
}
public static void main(String[ ] args) throws UserException {
App t = new App ();
t.doRegister("Mathew", 60);
}
}
結果は何ですか?
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
public void doRegister(String name, int age)
throws UserException, AgeOutOfLimitException {
if (name.length () < 6) {
throw new UserException ();
} else if (age >= 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println("User is registered.");
}
}
public static void main(String[ ] args) throws UserException {
App t = new App ();
t.doRegister("Mathew", 60);
}
}
結果は何ですか?
Correct Answer: A
Question 6
次のコードフラグメントを考えてみましょう:

ProductCode クラスを定義するように求められています。ProductCode クラスの定義では、c1 のインスタンス化が成功し、c2 のインスタンス化でコンパイルエラーが発生するようにする必要があります。
要件を満たす ProductCode の定義はどれですか?

ProductCode クラスを定義するように求められています。ProductCode クラスの定義では、c1 のインスタンス化が成功し、c2 のインスタンス化でコンパイルエラーが発生するようにする必要があります。
要件を満たす ProductCode の定義はどれですか?
Correct Answer: B
Question 7
Given:
class Bird {
public void fly () { System.out.print("Can fly"); }
}
class Penguin extends Bird {
public void fly () { System.out.print("Cannot fly"); }
}
and the code fragment:
class Birdie {
public static void main (String [ ] args) {
fly( ( ) -> new Bird ( ));
fly (Penguin : : new);
}
/* line n1 */
}
Which code fragment, when inserted at line n1, enables the Birdie class to compile?
class Bird {
public void fly () { System.out.print("Can fly"); }
}
class Penguin extends Bird {
public void fly () { System.out.print("Cannot fly"); }
}
and the code fragment:
class Birdie {
public static void main (String [ ] args) {
fly( ( ) -> new Bird ( ));
fly (Penguin : : new);
}
/* line n1 */
}
Which code fragment, when inserted at line n1, enables the Birdie class to compile?
Correct Answer: C
Question 8
コードの断片を考えると:
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);
LocalDate nextYear = valentinesDay.plusYears(1);
nextYear.plusDays(15); //line n1
System.out.println(nextYear);
結果は何ですか?
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);
LocalDate nextYear = valentinesDay.plusYears(1);
nextYear.plusDays(15); //line n1
System.out.println(nextYear);
結果は何ですか?
Correct Answer: B