Oracle Java SE 8 Programmer II (1z0-809日本語版) - 1z0-809日本語 模擬練習

Given:

and the code fragment:

結果は何ですか?

正解: B
コードの断片を考えると:
List<String> str = Arrays.asList ("my", "pen", "is", "your', "pen");
Predicate<String> test = s -> {
int i = 0;
boolean result = s.contains ("pen");
System.out.print(i++) + ":");
return result;
};
str.stream()
.filter(test)
.findFirst()
.ifPresent(System.out ::print);
結果は何ですか?

正解: E
EHF テーブルと DEPT テーブルの構造は次のようになります。

次のコードフラグメントを考えてみましょう:

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

正解: C
Given:
class RateOfInterest {
public static void main (String[] args) {
int rateOfInterest = 0;
String accountType = "LOAN";
switch (accountType) {
case "RD";
rateOfInterest = 5;
break;
case "FD";
rateOfInterest = 10;
break;
default:
assert false: "No interest for this account"; //line n1
}
System.out.println ("Rate of interest:" + rateOfInterest);
}
}
and the command:
java -ea RateOfInterest
What is the result?

正解: C
Which code fragment is required to load a JDBC 3.0 driver?

正解: C
Given:
class Student {
String course, name, city;
public Student (String name, String course, String city) {
this.course = course; this.name = name; this.city = city;
}
public String toString() {
return course + ":" + name + ":" + city;
}
and the code fragment:
List<Student> stds = Arrays.asList(
new Student ("Jessy", "Java ME", "Chicago"),
new Student ("Helen", "Java EE", "Houston"),
new Student ("Mark", "Java ME", "Chicago"));
stds.stream()
.collect(Collectors.groupingBy(Student::getCourse))
.forEach(src, res) -> System.out.println(scr));
結果は何ですか?

正解: D
Given:
final class Folder {//line n1
//line n2
public void open () {
System.out.print("Open");
}
}
public class Test {
public static void main (String [] args) throws Exception {
try (Folder f = new Folder()) {
f.open();
}
}
}
どの2つの変更により、コードでOpen Closeを印刷できますか?

正解: D,E
コードの断片を考えると:

そして

結果は何ですか?

正解: A
Given:
public interface Moveable<Integer> {
public default void walk (Integer distance)
{System.out.println("Walking");)
public void run(Integer distance);
}
Which statement is true?

正解: A
どのクラス定義がコンパイルされますか?

正解: A
Given:

and this code fragment:

What is the result?

正解: C
Given the definition of the Employee class:

and this code fragment:

結果は何ですか?

正解: B
与えられた:
class FuelNotAvailException extends Exception { }
class Vehicle {
void ride() throws FuelNotAvailException {//line n1
System.out.println("Happy Journey!");
}
}
class SolarVehicle extends Vehicle {
public void ride () throws FuelNotAvailException {//line n2
super ride ();
}
}
そしてコードの断片:
public static void main (String[] args) throws Exception {
Vehicle v = new SolarVehicle ();
v.ride();
}
どの変更により、コードフラグメントはHappy Journey !?を出力できますか?

正解: B
コードの断片を考えると:
Path source = Paths.get ("/data/december/log.txt");
Path destination = Paths.get("/data");
Files.copy (source, destination);
and assuming that the file /data/december/log.txt is accessible and
contains:
10-Dec-2014 ?Executed successfully
What is the result?

正解: A