[2025年12月19日] 最新の1z0-809試験の的確なJava SE 8 Programmer IIのPDF問題 [Q77-Q92]

Share

[2025年12月19日] 最新の1z0-809試験の的確なJava SE 8 Programmer IIのPDF問題

1z0-809試験問題を練習するならPassTest顕著なJava SE 8 Programmer II試験練習問題集

質問 # 77
Given:
public enum USCurrency {
PENNY (1),
NICKLE(5),
DIME (10),
QUARTER(25);
private int value;
public USCurrency(int value) {
this.value = value;
}
public int getValue() {return value;}
}
public class Coin {
public static void main (String[] args) {
USCurrency usCoin =new USCurrency.DIME;
System.out.println(usCoin.getValue()):
}
}
Which two modifications enable the given code to compile?

  • A. Make the USCurrencyenumeration constructor private.
  • B. Nest the USCurrencyenumeration declaration within the Coinclass.
  • C. Remove the newkeyword from the instantion of usCoin.
  • D. Add the finalkeyword in the declaration of value.
  • E. Make the getter method of valueas a staticmethod.

正解:B、D


質問 # 78
Given the code fragments :

and

What is the result?

  • A. TV Price :1000 Refrigerator Price :2000
  • B. The program prints nothing.
  • C. TV Price :110 Refrigerator Price :2100
  • D. A compilation error occurs.

正解:C


質問 # 79
Given: What is the result?

  • A. Out of limits
  • B. Out of limits hEllOjAvA!
  • C. hEllOjAvA!
  • D. Hello java!

正解:B


質問 # 80
Given that course.txt is accessible and contains:
Course : : Java
and given the code fragment:
public static void main (String[ ] args) {
int i;
char c;
try (FileInputStream fis = new FileInputStream ("course.txt");
InputStreamReader isr = new InputStreamReader(fis);) {
while (isr.ready()) { //line n1
isr.skip(2);
i = isr.read ();
c = (char) i;
System.out.print(c);
}
} catch (Exception e) {
e.printStackTrace();
}
}
What is the result?
ur :: va

  • A. ueJa
  • B. A compilation error occurs at line n1.
  • C. The program prints nothing.
  • D.

正解:D


質問 # 81
Given the code fragments:

and

Which two modifications enable to sort the elements of the emps list? (Choose two.)

  • A. Replace line n1 withclass Person extends Comparator<Person>
  • B. Replace line n1 withclass Person implements Comparable<Person>
  • C. Replace line n1 withclass Person implements Comparator<Person>
  • D. At line n2 insertpublic int compareTo (Person p) {return this.name.compareTo (p.name);}
  • E. At line n2 insertpublic int compare (Person p1, Person p2) {return p1.name.compareTo (p2.name);}
  • F. At line n2 insert:public int compareTo (Person p, Person p2) {return p1.name.compareTo (p2.name);}

正解:B、D


質問 # 82
Given the code fragment:

Which code fragment, when inserted at line n1, ensures false is printed?

  • A. boolean b = cs.stream() .anyMatch (w -> w.equals ("Java"));
  • B. boolean b = cs.stream() .findAny() .get() .equals("Java");
  • C. boolean b = cs.stream() .findFirst() .get() .equals("Java");
  • D. boolean b = cs.stream() .allMatch(w -> w.equals("Java"));

正解:C


質問 # 83
Given the code fragment:

Which is the valid definition of the Course enum?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D

正解:D


質問 # 84
Given:

What is the result?

  • A. Hi Interface-1
  • B. Hi MyClass
  • C. Hi Interface-2
  • D. A compilation error occurs.

正解:B


質問 # 85
Given the code fragment:

What is the result?

  • A. A compilation error occurs at line n1.
  • B. Logged out at: 2015-01-12T21:58:19.880Z
  • C. Can't logout
  • D. Logged out at: 2015-01-12T21:58:00Z

正解:D


質問 # 86
Which class definition compiles?

  • A.
  • B.
  • C.
  • D.

正解:A

解説:
Explanation


質問 # 87
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;
}
public String getCourse() {return course;}
public String getName() {return name;}
public String getCity() {return 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));
What is the result?

  • A. [Java ME: Jessy:Chicago, Java ME: Mark:Chicago]
    [ Java EE: Helen:Houston]
  • B. [Java EE: Helen:Houston]
    [Java ME: Jessy:Chicago, Java ME: Mark:Chicago]
  • C. Java EE
    Java ME
  • D. A compilation error occurs.

正解:C

解説:
Explanation/Reference:


質問 # 88
Given the code fragment:
public class Foo {
public static void main (String [ ] args) {
Map<Integer, String> unsortMap = new HashMap< > ( );
unsortMap.put (10, “z”);
unsortMap.put (5, “b”);
unsortMap.put (1, “d”);
unsortMap.put (7, “e”);
unsortMap.put (50, “j”);
Map<Integer, String> treeMap = new TreeMap <Integer, String> (new
Comparator<Integer> ( ) {
@Override public int compare (Integer o1, Integer o2) {return
o2.compareTo
(o1); } } );
treeMap.putAll (unsortMap);
for (Map.Entry<Integer, String> entry : treeMap.entrySet () ) {
System.out.print (entry.getValue () + “ “);
}
}
}
What is the result?

  • A. z b d e j
  • B. d b e z j
  • C. A compilation error occurs.
  • D. j z e b d

正解:D


質問 # 89
Given the records from the Employeetable:

and given the code fragment:
try {
Connection conn = DriverManager.getConnection (URL, userName,
passWord);
Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
st.execute("SELECT*FROM Employee");
ResultSet rs = st.getResultSet();
while (rs.next()) {
if (rs.getInt(1) ==112) {
rs.updateString(2, "Jack");
}
}
rs.absolute(2);
System.out.println(rs.getInt(1) + " " + rs.getString(2));
} catch (SQLException ex) {
System.out.println("Exception is raised");
}
Assume that:
The required database driver is configured in the classpath.
The appropriate database accessible with the URL, userName, and passWordexists.
What is the result?

  • A. The Employee table is updated with the row:
    1 12 Jack
    and the program prints:
    1 12 Jerry
  • B. The Employee table is updated with the row:
    1 12 Jack
    and the program prints:
    1 12 Jack
  • C. The program prints Exception is raised.
  • D. The Employee table is not updated and the program prints:
    1 12 Jerry

正解:D


質問 # 90
Given the code fragments:
class Caller implements Callable<String> {
String str;
public Caller (String s) {this.str=s;}
public String call()throws Exception { return str.concat ("Caller");}
}
class Runner implements Runnable {
String str;
public Runner (String s) {this.str=s;}
public void run () { System.out.println (str.concat ("Runner"));}
}
and
public static void main (String[] args) InterruptedException, ExecutionException { ExecutorService es = Executors.newFixedThreadPool(2); Future f1 = es.submit (new Caller ("Call")); Future f2 = es.submit (new Runner ("Run")); String str1 = (String) f1.get(); String str2 = (String) f2.get();//line n1 System.out.println(str1+ ":" + str2);
}
What is the result?

  • A. The program terminates after printing:Run RunnerCall Caller : Run
  • B. A compilation error occurs at line n1.
  • C. An Execution is thrown at run time.
  • D. The program prints:Run RunnerCall Caller : nullAnd the program does not terminate.

正解:D


質問 # 91
Given the code fragment:

Assume that dbURL, userName, and passwordare valid.
Which code fragment can be inserted at line n1to enable the code to print Connection Established?
Properties prop = new Properties();

  • A. prop.put ("userid", userName);
    prop.put ("password", password);
    prop.put("url", dbURL);
    con = DriverManager.getConnection (prop);
    con = DriverManager.getConnection (dbURL);
  • B. prop.put ("user", userName);
    prop.put ("password", password);
    con = DriverManager.getConnection (dbURL, prop);
    con = DriverManager.getConnection (userName, password, dbURL);
  • C. Properties prop = new Properties();
  • D. con.setClientInfo ("user", userName);
    con.setClientInfo ("password", password);

正解:B


質問 # 92
......

試験問題と解答は1z0-809学習ガイド問題解答:https://www.passtest.jp/Oracle/1z0-809-shiken.html

練習用1z0-809にはPassTest顕著な問題集はあなたをJava SE 8 Programmer II試験合格させます合格させる:https://drive.google.com/open?id=1WCs7LXkeSUjQZ1jUqIROIrce9545EzJR