oracle 1z0-809 practice test

Java SE 8 Programmer II Exam

Last exam update: Jul 20 ,2024
Page 1 out of 11. Viewing questions 1-15 out of 164

Question 1

Given the structure of the Student table:
Student (id INTEGER, name VARCHAR)
Given the records from the STUDENT table:

Given the code fragment:

Assume that:
The required database driver is configured in the classpath.
The appropriate database is accessible with the dbURL, userName, and passWord exists.
What is the result?

  • A. The program prints Status: true and two records are deleted from the Student table.
  • B. The program prints Status: false and two records are deleted from the Student table.
  • C. A SQLException is thrown at runtime.
  • D. The program prints Status: false but the records from the Student table are not deleted.
Answer:

B

User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 2

Given the code fragment:

Which should be inserted into line n1 to print Average = 2.5?

  • A. IntStream str = Stream.of (1, 2, 3, 4);
  • B. IntStream str = IntStream.of (1, 2, 3, 4);
  • C. DoubleStream str = Stream.of (1.0, 2.0, 3.0, 4.0);
  • D. Stream str = Stream.of (1, 2, 3, 4);
Answer:

C

User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 3

Which two statements are true about synchronization and locks? (Choose two.)

  • A. A thread automatically acquires the intrinsic lock on a synchronized statement when executed.
  • B. The intrinsic lock will be retained by a thread if return from a synchronized method is caused by an uncaught exception.
  • C. A thread exclusively owns the intrinsic lock of an object between the time it acquires the lock and the time it releases it.
  • D. A thread automatically acquires the intrinsic lock on a synchronized methods object when entering that method.
  • E. Threads cannot acquire intrinsic locks on classes.
Answer:

A,B

User Votes:
A 1 votes
50%
B 1 votes
50%
C 1 votes
50%
D 1 votes
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 4

Which two statements are true about the Fork/Join Framework? (Choose two.)

  • A. The RecursiveTask subclass is used when a task does not need to return a result.
  • B. The Fork/Join framework can help you take advantage of multicore hardware.
  • C. The Fork/Join framework implements a work-stealing algorithm.
  • D. The Fork/Join solution when run on multicore hardware always performs faster than standard sequential solution.
Answer:

A,C

User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 5

Given the code fragment:

Which code fragment, when inserted at line 7, enables printing 100?

  • A. Function<Integer> funRef = e –> e + 10;Integer result = funRef.apply(value);
  • B. IntFunction funRef = e –> e + 10;Integer result = funRef.apply (10);
  • C. ToIntFunction<Integer> funRef = e –> e + 10;int result = funRef.applyAsInt (value);
  • D. ToIntFunction funRef = e –> e + 10;int result = funRef.apply (value);
Answer:

A

User Votes:
A
50%
B
50%
C 1 votes
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 6

Given the records from the STUDENT table:

Given the code fragment:

Assume that the URL, username, and password are valid.
What is the result?

Answer:

D

User Votes:
A
50%
B
50%
C
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 7

Given the code fragments:

and

What is the result?

  • A. null
  • B. A compilation error occurs.
  • C. DogCatMouse
  • D. [Dog, Cat, Mouse]
Answer:

D

User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 8

Given the Greetings.properties file, containing:

and given:

What is the result?

  • A. Compilation fails.
  • B. GOODBY_MSG
  • C. Hello, everyone!
  • D. Goodbye everyone!
  • E. HELLO_MSG
Answer:

A

User Votes:
A 1 votes
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 9

Given the code fragment:

Assume that dbURL, userName, and password are valid.
Which code fragment can be inserted at line n1 to enable the code to print Connection Established?

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

A

User Votes:
A 1 votes
50%
B
50%
C
50%
Discussions
vote your answer:
A
B
C
0 / 1000

Question 10

Given:

and the code fragment:

What is the result?

  • A. 0.0
  • B. 1500.0
  • C. A compilation error occurs.
  • D. 2000.0
Answer:

B

User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 11

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. At line n2 insertpublic int compareTo (Person p) {return this.name.compareTo (p.name);}
  • C. Replace line n1 withclass Person implements Comparable<Person>
  • D. At line n2 insertpublic int compare (Person p1, Person p2) {return p1.name.compareTo (p2.name);}
  • E. At line n2 insert:public int compareTo (Person p, Person p2) {return p1.name.compareTo (p2.name);}
  • F. Replace line n1 withclass Person implements Comparator<Person>
Answer:

B,C

User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D
50%
E
50%
F
50%
Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000

Question 12

Given the code fragment:

Which two code fragments, when inserted at line n1 independently, result in the output PEEK: Unix?

  • A. .anyMatch ();
  • B. .allMatch ();
  • C. .findAny ();
  • D. .noneMatch ();
  • E. .findFirst ();
Answer:

C,E

User Votes:
A
50%
B
50%
C 1 votes
50%
D
50%
E 1 votes
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 13

Given:

and the code fragment:

Which definition of the ColorSorter class sorts the blocks list?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Answer:

C

User Votes:
A
50%
B
50%
C 1 votes
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 14

Given:

What is the result?

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

D

User Votes:
A
50%
B
50%
C
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 15

Given the code fragment:

What is the result?

  • A. Word: why what when
  • B. Word: why Word: why what Word: why what when
  • C. Word: why Word: what Word: when
  • D. Compilation fails at line n1.
Answer:

A

User Votes:
A 1 votes
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
To page 2