Weekend Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: xmas50

Oracle 1z0-809 - Java SE 8 Programmer II

Page: 6 / 6
Total 196 questions

Which two methods from the java.util.stream.Stream interface perform a reduction operation? (Choose two.)

A.

count ()

B.

collect ()

C.

distinct ()

D.

peek ()

E.

filter ()

Which two code blocks correctly initialize a Locale variable? (Choose two.)

A.

Locale loc1 = “UK”;

B.

Locale loc2 = Locale.getInstance(“ru”);

C.

Locale loc3 = Locale.getLocaleFactory(“RU”);

D.

Locale loc4 = Locale.UK;

E.

Locale loc5 = new Locale (“ru”, “RU”);

Given:

and the code fragment:

What is the result?

A.

A compilation error occurs at line n2.

B.

A compilation error occurs because the try block doesn’t have a catch or finally block.

C.

A compilation error occurs at line n1.

D.

The program compiles successfully.

Given the code fragments:

class ThreadRunner implements Runnable {

public void run () { System.out.print (“Runnable”) ; }

}

class ThreadCaller implements Callable {

Public String call () throws Exception {return “Callable”; )

}

and

ExecutorService es = Executors.newCachedThreadPool ();

Runnable r1 = new ThreadRunner ();

Callable c1 = new ThreadCaller ();

// line n1

es.shutdown();

Which code fragment can be inserted at line n1 to start r1 and c1 threads?

A.

Future f1 = (Future) es.submit (r1);es.execute (c1);

B.

es.execute (r1);Future f1 = es.execute (c1) ;

C.

Future f1 = (Future) es.execute(r1);Future f2 = (Future) es.execute(c1);

D.

es.submit(r1);Future f1 = es.submit (c1);

and the code fragment?

What is the result?

A.

$15.00

B.

15 $

C.

USD 15.00

D.

USD $15

Which code fragment is required to load a JDBC 3.0 driver?

A.

Connection con = Connection.getDriver(“jdbc:xyzdata://localhost:3306/EmployeeDB”);

B.

Class.forName(“org.xyzdata.jdbc.NetworkDriver”);

C.

Connection con = DriverManager.getConnection(“jdbc:xyzdata://localhost:3306/EmployeeDB”);

D.

DriverManager.loadDriver (“org.xyzdata.jdbc.NetworkDriver”);

Given the code fragment:

LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);

LocalDate next15days = valentinesDay.plusDays (15);

LocalDate nextYear = next15days.plusYears(1); // line n1

System.out.println(nextYear);

What is the result?

A.

2016-03-01

B.

A DateTimeException is thrown.

C.

2016-02-29

D.

A compilation error occurs at line n1.

Given:

and the code fragment:

Which two code fragments, when inserted at line n1 independently, enable the code to print TruckCarBike?

A.

.sorted ((v1, v2) -> v1.getVId() < v2.getVId())

B.

.sorted (Comparable.comparing (Vehicle: :getVName)).reversed ()

C.

.map (v -> v.getVid()).sorted ()

D.

.sorted((v1, v2) -> Integer.compare(v1.getVId(), v2.getVid()))

E.

.sorted(Comparator.comparing ((Vehicle v) -> v.getVId()))