Labour Day Special - 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: c4sdisc65

1z0-809 PDF

$38.5

$109.99

3 Months Free Update

  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions

1z0-809 PDF + Testing Engine

$61.6

$175.99

3 Months Free Update

  • Exam Name: Java SE 8 Programmer II
  • Last Update: May 5, 2024
  • Questions and Answers: 196
  • Free Real Questions Demo
  • Recommended by Industry Experts
  • Best Economical Package
  • Immediate Access

1z0-809 Engine

$46.2

$131.99

3 Months Free Update

  • Best Testing Engine
  • One Click installation
  • Recommended by Teachers
  • Easy to use
  • 3 Modes of Learning
  • State of Art Technology
  • 100% Real Questions included

1z0-809 Practice Exam Questions with Answers Java SE 8 Programmer II Certification

Question # 6

Given the code fragment:

Path path1 = Paths.get(“/app/./sys/”);

Path res1 = path1.resolve(“log”);

Path path2 = Paths.get(“/server/exe/”);

Path res1 = path1.resolve(“/readme/”);

System.out.println(res1);

System.out.println(res2);

What is the result?

A.

/app/sys/log/readme/server/exe

B.

/app/log/sys/server/exe/readme

C.

/app/./sys/log/readme

D.

/app/./sys/log/server/exe/readme

Full Access
Question # 7

Given:

1z0-809 question answer

and the code fragment:

1z0-809 question answer

Which modification enables the code fragment to print Speaker?

A.

Implement Predicate in the Product.ProductFilter class and replace line n2 with .filter (p -> p.ProductFilter.test (p))

B.

Replace line n1 with:public static boolean isAvailable (Product p) {

C.

Replace line n2 with:.filter (p -> p.ProductFilter: :isAvailable (p))

D.

Replace line n2 with:.filter (p -> Product: :ProductFilter: :isAvailable ())

Full Access
Question # 8

Given the code fragment:

1z0-809 question answer

What is the result?

A.

A compilation error occurs at line n1.

B.

A compilation error occurs at line n2.

C.

The code reads the password without echoing characters on the console.

D.

A compilation error occurs because the IOException isn’t declared to be thrown or caught?

Full Access
Question # 9

Given the code fragment:

public class Foo {

public static void main (String [ ] args) {

Map unsortMap = new HashMap< > ( );

unsortMap.put (10, “z”);

unsortMap.put (5, “b”);

unsortMap.put (1, “d”);

unsortMap.put (7, “e”);

unsortMap.put (50, “j”);

Map treeMap = new TreeMap (new

Comparator ( ) {

@Override public int compare (Integer o1, Integer o2) {return o2.compareTo

(o1); } } );

treeMap.putAll (unsortMap);

for (Map.Entry entry : treeMap.entrySet () ) {

System.out.print (entry.getValue () + “ “);

}

}

}

What is the result?

A.

A compilation error occurs.

B.

d b e z j

C.

j z e b d

D.

z b d e j

Full Access
Question # 10

Given the code fragment:

Path p1 = Paths.get(“/Pics/MyPic.jpeg”);

System.out.println (p1.getNameCount() +

“:” + p1.getName(1) +

“:” + p1.getFileName());

Assume that the Pics directory does NOT exist.

What is the result?

A.

An exception is thrown at run time.

B.

2:MyPic.jpeg: MyPic.jpeg

C.

1:Pics:/Pics/ MyPic.jpeg

D.

2:Pics: MyPic.jpeg

Full Access
Question # 11

Given:

class Vehicle implements Comparable{

int vno;

String name;

public Vehicle (int vno, String name) {

this.vno = vno,;

this.name = name;

}

public String toString () {

return vno + “:” + name;

}

public int compareTo(Vehicle o) {

return this.name.compareTo(o.name);

}

and this code fragment:

Set vehicles = new TreeSet <> ();

vehicles.add(new Vehicle (10123, “Ford”));

vehicles.add(new Vehicle (10124, “BMW”));

System.out.println(vehicles);

What is the result?

A.

[10123:Ford, 10124:BMW]

B.

[10124:BMW, 10123:Ford]

C.

A compilation error occurs.

D.

A ClassCastException is thrown at run time.

Full Access
Question # 12

For which three objects must a vendor provide implementations in its JDBC driver? (Choose three.)

A.

Time

B.

Date

C.

Statement

D.

ResultSet

E.

Connection

F.

SQLException

G.

DriverManager

Full Access
Question # 13

Given:

class Book {

int id;

String name;

public Book (int id, String name) {

this.id = id;

this.name = name;

}

public boolean equals (Object obj) { //line n1

boolean output = false;

Book b = (Book) obj;

if (this.name.equals(b name))}

output = true;

}

return output;

}

}

and the code fragment:

Book b1 = new Book (101, “Java Programing”);

Book b2 = new Book (102, “Java Programing”);

System.out.println (b1.equals(b2)); //line n2

Which statement is true?

A.

The program prints true.

B.

The program prints false.

C.

A compilation error occurs. To ensure successful compilation, replace line n1 with:boolean equals (Book obj) {

D.

A compilation error occurs. To ensure successful compilation, replace line n2 with:System.out.println (b1.equals((Object) b2));

Full Access
Question # 14

Given the code fragment:

1z0-809 question answer

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

Full Access
Question # 15

Given the code fragment:

1z0-809 question answer

What is the result?

A.

DavidDavid[Susan, Allen]

B.

SusanSusan[Susan, Allen]

C.

SusanAllen[David]

D.

DavidAllen[Susan]

E.

SusanAllen[Susan, David]

Full Access
Question # 16

Given the code fragment:

List list1 = Arrays.asList(10, 20);

List list2 = Arrays.asList(15, 30);

//line n1

Which code fragment, when inserted at line n1, prints 10 20 15 30?

A.

Stream.of(list1, list2).flatMap(list -> list.stream()).forEach(s -> System.out.print(s + “ “));

B.

Stream.of(list1, list2).flatMap(list -> list.intStream()).forEach(s -> System.out.print(s + “ “));

C.

list1.stream().flatMap(list2.stream().flatMap(e1 -> e1.stream()).forEach(s -> System.out.println(s + “ “));

D.

Stream.of(list1, list2).flatMapToInt(list -> list.stream()).forEach(s -> System.out.print(s + “ “));

Full Access
Question # 17

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.

Full Access
Question # 18

Given the code fragment:

1z0-809 question answer

What is the result?

A.

A compilation error occurs at line n2.

B.

3

C.

2

D.

A compilation error occurs at line n1.

Full Access
Question # 19

Given the code fragment:

1z0-809 question answer

What is the result?

A.

A compilation error occurs.

B.

[Java, J2EE, J2ME, JSTL, JSP]

C.

null

D.

[Java, J2EE, J2ME, JSTL]

Full Access
Question # 20

Given the code fragment:

List nL = Arrays.asList(“Jim”, “John”, “Jeff”);

Function funVal = s -> “Hello : “.concat(s);

nL.Stream()

.map(funVal)

.forEach(s-> System.out.print (s));

What is the result?

A.

Hello : Jim Hello : John Hello : Jeff

B.

Jim John Jeff

C.

The program prints nothing.

D.

A compilation error occurs.

Full Access
Question # 21

Given:

class Vehicle {

int vno;

String name;

public Vehicle (int vno, String name) {

this.vno = vno,;

this.name = name;

}

public String toString () {

return vno + “:” + name;

}

}

and this code fragment:

Set vehicles = new TreeSet <> ();

vehicles.add(new Vehicle (10123, “Ford”));

vehicles.add(new Vehicle (10124, “BMW”));

System.out.println(vehicles);

What is the result?

A.

10123 Ford10124 BMW

B.

10124 BMW10123 Ford

C.

A compilation error occurs.

D.

A ClassCastException is thrown at run time.

Full Access
Question # 22

Given the code fragment:

Stream files = Files.list(Paths.get(System.getProperty(“user.home”)));

files.forEach (fName -> {//line n1

try {

Path aPath = fName.toAbsolutePath();//line n2

System.out.println(fName + “:”

+ Files.readAttributes(aPath, Basic.File.Attributes.class).creationTime

());

} catch (IOException ex) {

ex.printStackTrace();

});

What is the result?

A.

All files and directories under the home directory are listed along with their attributes.

B.

A compilation error occurs at line n1.

C.

The files in the home directory are listed along with their attributes.

D.

A compilation error occurs at line n2.

Full Access
Question # 23

Given the code fragment:

9. Connection conn = DriveManager.getConnection(dbURL, userName, passWord);

10. String query = “SELECT id FROM Employee”;

11. try (Statement stmt = conn.createStatement()) {

12. ResultSet rs = stmt.executeQuery(query);

13.stmt.executeQuery(“SELECT id FROM Customer”);

14. while (rs.next()) {

15. //process the results

16.System.out.println(“Employee ID: “+ rs.getInt(“id”));

17.}

18. } catch (Exception e) {

19. System.out.println (“Error”);

20. }

Assume that:

The required database driver is configured in the classpath.

The appropriate database is accessible with the dbURL, userName, and passWord exists.

The Employee and Customer tables are available and each table has id column with a few records and the SQL queries are valid.

What is the result of compiling and executing this code fragment?

A.

The program prints employee IDs.

B.

The program prints customer IDs.

C.

The program prints Error.

D.

compilation fails on line 13.

Full Access
Question # 24

Given the code fragment:

List nums = Arrays.asList (10, 20, 8):

System.out.println (

//line n1

);

Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the nums list?

A.

nums.stream().max(Comparator.comparing(a -> a)).get()

B.

nums.stream().max(Integer : : max).get()

C.

nums.stream().max()

D.

nums.stream().map(a -> a).max()

Full Access
Question # 25

Which two are elements of a singleton class? (Choose two.)

A.

a transient reference to point to the single instance

B.

a public method to instantiate the single instance

C.

a public static method to return a copy of the singleton reference

D.

a private constructor to the class

E.

a public reference to point to the single instance

Full Access
Question # 26

Given the code fragment:

1z0-809 question answer

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

Full Access
Question # 27

Given the code fragments:

4. void doStuff() throws ArithmeticException, NumberFormatException, Exception {

5. if (Math.random() >-1 throw new Exception (“Try again”);

6. }

and

24. try {

25. doStuff ( ):

26. } catch (ArithmeticException | NumberFormatException | Exception e) {

27. System.out.println (e.getMessage()); }

28. catch (Exception e) {

29. System.out.println (e.getMessage()); }

30. }

Which modification enables the code to print Try again?

A.

Comment the lines 28, 29 and 30.

B.

Replace line 26 with:} catch (Exception | ArithmeticException | NumberFormatException e) {

C.

Replace line 26 with:} catch (ArithmeticException | NumberFormatException e) {

D.

Replace line 27 with:throw e;

Full Access
Question # 28

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

Full Access
Question # 29

Given the content:

1z0-809 question answer

and given the code fragment:

1z0-809 question answer

Which two code fragments, when inserted at line 1 independently, enable the code to print “Wie geht’s?”

A.

currentLocale = new Locale (“de”, “DE”);

B.

currentLocale = new Locale.Builder ().setLanguage (“de”).setRegion (“DE”).build();

C.

currentLocale = Locale.GERMAN;

D.

currentlocale = new Locale();currentLocale.setLanguage (“de”);currentLocale.setRegion (“DE”);

E.

currentLocale = Locale.getInstance(Locale.GERMAN,Locale.GERMANY);

Full Access