Weekend Special 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sale65best

Free Oracle 1z0-809 Practice Exam with Questions & Answers

Questions 1

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:

1z0-809 Question 1

Which is the result?

Options:
A.

3:00 – difference: 2

B.

2:00 – difference: 1

C.

4:00 – difference: 3

D.

4:00 – difference: 2

Oracle 1z0-809 Premium Access
Questions 2

Given the code fragment:

1z0-809 Question 2

What is the result?

Options:
A.

text1text2

B.

text1text2text2text3

C.

text1

D.

[text1, text2]

Questions 3

Given the code fragment:

1z0-809 Question 3

and the information:

  • 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?

Options:
A.

A ClassNotFoundException is thrown at runtime.

B.

The program prints nothing.

C.

The program prints Connection Established.

D.

A SQLException is thrown at runtime.

Questions 4

Given:

1z0-809 Question 4

and the command:

java Product 0

What is the result?

Options:
A.

An AssertionError is thrown.

B.

A compilation error occurs at line n1.

C.

New Price: 0.0

D.

A NumberFormatException is thrown at run time.

Questions 5

Given that these files exist and are accessible:

1z0-809 Question 5

and given the code fragment:

1z0-809 Question 5

Which code fragment can be inserted at line n1 to enable the code to print only /company/emp?

Options:
A.

Stream stream = Files.list (Paths.get (“/company”));

B.

Stream stream = Files.find(Paths.get (“/company”), 1,(p,b) –> b.isDirectory (), FileVisitOption.FOLLOW_LINKS);

C.

Stream stream = Files.walk (Paths.get (“/company”));

D.

Stream stream = Files.list (Paths.get (“/company/emp”));

Questions 6

Given the code fragment:

Path source = Paths.get (“/data/december/log.txt”);

Path destination = Paths.get(“/data”);

Files.copy (source, destination);

and assuming that the file /data/december/log.txt is accessible and contains:

10-Dec-2014 – Executed successfully

What is the result?

Options:
A.

A file with the name log.txt is created in the /data directory and the content of the /data/december/log.txt file is copied to it.

B.

The program executes successfully and does NOT change the file system.

C.

A FileNotFoundException is thrown at run time.

D.

A FileAlreadyExistsException is thrown at run time.

Questions 7

Given the definition of the Book class:

1z0-809 Question 7

Which statement is true about the Book class?

Options:
A.

It demonstrates encapsulation.

B.

It is defined using the factory design pattern.

C.

It is defined using the singleton design pattern.

D.

It demonstrates polymorphism.

E.

It is an immutable class.

Questions 8

Given the code fragments:

public class Book implements Comparator {

String name;

double price;

public Book () {}

public Book(String name, double price) {

this.name = name;

this.price = price;

}

public int compare(Book b1, Book b2) {

return b1.name.compareTo(b2.name);

}

public String toString() {

return name + “:” + price;

}

}

and

Listbooks = Arrays.asList (new Book (“Beginning with Java”, 2), new book (“A

Guide to Java Tour”, 3));

Collections.sort(books, new Book());

System.out.print(books);

What is the result?

Options:
A.

[A Guide to Java Tour:3.0, Beginning with Java:2.0]

B.

[Beginning with Java:2, A Guide to Java Tour:3]

C.

A compilation error occurs because the Book class does not override the abstract method compareTo().

D.

An Exception is thrown at run time.

Questions 9

Given the code fragment:

1z0-809 Question 9

Which modification enables the code to print Price 5 New Price 4?

Options:
A.

Replace line n2 with .map (n -> System.out.println (“New Price” + n –1)) and remove line n3

B.

Replace line n2 with .mapToInt (n -> n – 1);

C.

Replace line n1 with .forEach (e -> System.out.print (“Price” + e))

D.

Replace line n3 with .forEach (n -> System.out.println (“New Price” + n));

Questions 10

Given the code fragment:

ZonedDateTime depart = ZonedDateTime.of(2015, 1, 15, 3, 0, 0, 0, ZoneID.of(“UTC-7”));

ZonedDateTime arrive = ZonedDateTime.of(2015, 1, 15, 9, 0, 0, 0, ZoneID.of(“UTC-5”));

long hrs = ChronoUnit.HOURS.between(depart, arrive); //line n1

System.out.println(“Travel time is” + hrs + “hours”);

What is the result?

Options:
A.

Travel time is 4 hours

B.

Travel time is 6 hours

C.

Travel time is 8 hours

D.

An exception is thrown at line n1.

Exam Code: 1z0-809
Certification Provider: Oracle
Exam Name: Java SE 8 Programmer II
Last Update: Feb 8, 2025
Questions: 196