Spring Sale Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: buysanta

Exact2Pass Menu

Java SE 8 Programmer II

Last Update 8 hours ago Total Questions : 208

The Java SE 8 Programmer II content is now fully updated, with all current exam questions added 8 hours ago. Deciding to include 1z0-809 practice exam questions in your study plan goes far beyond basic test preparation.

You'll find that our 1z0-809 exam questions frequently feature detailed scenarios and practical problem-solving exercises that directly mirror industry challenges. Engaging with these 1z0-809 sample sets allows you to effectively manage your time and pace yourself, giving you the ability to finish any Java SE 8 Programmer II practice test comfortably within the allotted time.

Question # 11

Given the code fragments:

interface CourseFilter extends Predicate < String > {

public default boolean test (String str) {

return str.contains (“Java”);

}

}

and

List < String > strs = Arrays.asList(“Java”, “Java EE”, “Embedded Java”);

Predicate < String > cf1 = s - > s.length() > 3;

Predicate cf2 = new CourseFilter() { //line n1

public boolean test (String s) {

return s.startsWith (“Java”);

}

};

long c = strs.stream()

.filter(cf1)

.filter(cf2//line n2

.count();

System.out.println(c);

What is the result?

A.

2

B.

3

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Question # 12

In 2015, daylight saving time in New York, USA, begins on March 8th at 2:00 AM. As a result, 2:00 AM becomes 3:00 AM.

Given the code fragment:

Which is the result?

A.

3:00 – difference: 2

B.

2:00 – difference: 1

C.

4:00 – difference: 3

D.

4:00 – difference: 2

Question # 13

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);

Question # 14

Given the code fragments:

interface CourseFilter extends Predicate < String > {

public default boolean test (String str) {

return str.equals (“Java”);

}

}

and

List < String > strs = Arrays.asList(“Java”, “Java EE”, “Java ME”);

Predicate < String > cf1 = s - > s.length() > 3;

Predicate cf2 = new CourseFilter() { //line n1

public boolean test (String s) {

return s.contains (“Java”);

}

};

long c = strs.stream()

.filter(cf1)

.filter(cf2//line n2

.count();

System.out.println(c);

What is the result?

A.

2

B.

3

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Question # 15

Which statement is true about the DriverManager class?

A.

It returns an instance of Connection.

B.

It executes SQL statements against the database.

C.

It only queries metadata of the database.

D.

it is written by different vendors for their specific database.

Question # 16

Given:

and the code fragment:

What is the result?

A.

0.0

B.

1500.0

C.

A compilation error occurs.

D.

2000.0

Question # 17

Given the code fragment:

Path file = Paths.get (“courses.txt”);

// line n1

Assume the courses.txt is accessible.

Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file?

A.

List < String > fc = Files.list(file);fc.stream().forEach (s - > System.out.println(s));

B.

Stream < String > fc = Files.readAllLines (file);fc.forEach (s - > System.out.println(s));

C.

List < String > fc = Files.readAllLines(file);fc.stream().forEach (s - > System.out.println(s));

D.

Stream < String > fc = Files.list (file);fc.forEach (s - > System.out.println(s));

Question # 18

Given the code fragment:

List < String > colors = Arrays.asList(“red”, “green”, “yellow”);

Predicate < String > test = n - > {

System.out.println(“Searching…”);

return n.contains(“red”);

};

colors.stream()

.filter(c - > c.length() > = 3)

.allMatch(test);

What is the result?

A.

Searching…

B.

Searching…Searching…

C.

Searching…Searching…Searching…

D.

A compilation error occurs.

Question # 19

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?

A.

An exception is thrown at runtime.

B.

Compilation fails.

C.

The code prints Error.

D.

The code prints information about Item 110.

Question # 20

Given the code fragment:

public void recDelete (String dirName) throws IOException {

File [ ] listOfFiles = new File (dirName) .listFiles();

if (listOfFiles ! = null & & listOfFiles.length > 0) {

for (File aFile : listOfFiles) {

if (!aFile.isDirectory ()) {

if (aFile.getName ().endsWith (“.class”))

aFile.delete ();

}

}

}

}

Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.

What is the result?

A.

The method deletes all the .class files in the Projects directory and its subdirectories.

B.

The method deletes the .class files of the Projects directory only.

C.

The method executes and does not make any changes to the Projects directory.

D.

The method throws an IOException.

Go to page: