Pre-Summer Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code = getmirror

Pass the Oracle Java SE 1z0-809 Questions and answers with ExamsMirror

Practice at least 50% of the questions to maximize your chances of passing.
Exam 1z0-809 Premium Access

View all detail and faqs for the 1z0-809 exam


733 Students Passed

84% Average Score

90% Same Questions
Viewing page 4 out of 7 pages
Viewing questions 31-40 out of questions
Questions # 31:

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?

Options:

A.

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

B.

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

C.

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

D.

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

Questions # 32:

Given:

class CheckClass {

public static int checkValue (String s1, String s2) {

return s1 length() – s2.length();

}

}

and the code fragment:

String[] strArray = new String [] {“Tiger”, “Rat”, “Cat”, “Lion”}

//line n1

for (String s : strArray) {

System.out.print (s + “ “);

}

Which code fragment should be inserted at line n1 to enable the code to print Rat Cat Lion Tiger?

Options:

A.

Arrays.sort(strArray, CheckClass : : checkValue);

B.

Arrays.sort(strArray, (CheckClass : : new) : : checkValue);

C.

Arrays.sort(strArray, (CheckClass : : new).checkValue);

D.

Arrays.sort(strArray, CheckClass : : new : : checkValue);

Questions # 33:

Given the code fragment:

Question # 33

You have been asked to define the ProductCode class. The definition of the ProductCode class must allow c1 instantiation to succeed and cause a compilation error on c2 instantiation.

Which definition of ProductCode meets the requirement?

Options:

A.
B.
C.
D.
Questions # 34:

Given:

Question # 34

Which two interfaces can you use to create lambda expressions? (Choose two.)

Options:

A.

T

B.

R

C.

P

D.

S

E.

Q

F.

U

Questions # 35:

Given:

Question # 35

Which is refactored code with functional interfaces?

Options:

A.

B.

C.

D.

Questions # 36:

Given the code fragment:

Question # 36

What is the result?

Options:

A.

A compilation error occurs at line n1.

B.

courseJava

C.

Javacourse

D.

A compilation error occurs at line n2.

Questions # 37:

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?

Options:

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

Questions # 38:

Given the code fragment:

Question # 38

Which code fragment, when inserted at line n1, enables the code to print /First.txt?

Options:

A.

Path iP = new Paths (“/First.txt”);

B.

Path iP = Paths.toPath (“/First.txt”);

C.

Path iP = new Path (“/First.txt”);

D.

Path iP = Paths.get (“/”, “First.txt”);

Questions # 39:

Given records from the Player table:

Question # 39

and given the code fragment:

try {

Connection conn = DriverManager.getConnection(URL, username, password);

Statement st= conn.createStatement(

ResultSet.TYPE_SCROLL_SENSITIVE,

ResultSet.CONCUR_UPDATABLE);

st.execute (“SELECT * FROM Player”);

st.setMaxRows(2);

ResultSet rs = st.getResultSet();

rs.absolute(3);

while (rs.next ()) {

System.out.println(rs.getInt(1) + “ “ + rs.getString(2));

}

} catch (SQLException ex) {

System.out.print(“SQLException is thrown.”);

}

Assume that:

The required database driver is configured in the classpath.

The appropriate database is accessible with URL, username, and password.

The SQL query is valid.

What is the result?

Options:

A.

2 Jack3 Sam

B.

The program prints nothing.

C.

3 Sam

D.

SQLException is thrown.

Questions # 40:

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?

Options:

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

Viewing page 4 out of 7 pages
Viewing questions 31-40 out of questions
TOP CODES

TOP CODES

Top selling exam codes in the certification world, popular, in demand and updated to help you pass on the first try.