[Free] 2017(July) Ensurepass Passguide Oracle 1Z0-809 Latest Dumps 41-50

Ensurepass
2017 July Oracle Official New Released 1Z0-809 Q&As
100% Free Download! 100% Pass Guaranteed!
http://www.ensurepass.com/1Z0-809.html

Java SE 8 Programmer II

QUESTION 41

Given the code fragment:

 

int b = 3;

 

if ( !(b > 3)) {

 

System.out.println(“square “);

 

}{

 

System.out.println(“circle “);

 

}

 

System.out.println(“…”);

 

What is the result?

 

A.

square…

B.

circle…

C.

squarecircle…

D.

Compilation fails.

 

Correct Answer: C

 

 

QUESTION 42

Given the code fragment:

 

clip_image001

 

What is the result?

 

A.

20

B.

25

C.

29

D.

Compilation fails

E.

AnArrayIndexOutOfBoundsException is thrown at runtime

 

Correct Answer: A

 

 

QUESTION 43

Given:

 

public class Emp {

 

String fName;

 

String lName;

 

public Emp (String fn, String ln) {

 

fName = fn;

 

lName = ln;

 

}

 

public String getfName() { return fName; }

 

public String getlName() { return lName; }

 

}

and the code fragment:

 

List<Emp> emp = Arrays.asList (

 

new Emp (“John”, “Smith”),

 

new Emp (“Peter”, “Sam”),

 

new Emp (“Thomas”, “Wale”));

 

emp.stream()

 

//line n1

 

.collect(Collectors.toList());

 

Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and then ascending order of lName?

 

A.

.sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing(Emp::getlName))

B.

.sorted (Comparator.comparing(Emp::getfName).thenComparing(Emp::getlName))

C.

.map(Emp::getfName).sorted(Comparator.reserveOrder())

D.

.map(Emp::getfName).sorted(Comparator.reserveOrder().map(Emp::getlName).reserved

 

Correct Answer: A

 

 

QUESTION 44

Given the code fragments:

 

public class Book implements Comparator<Book> {

 

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

 

List<Book>books = 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?

 

A.

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

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.

 

Correct Answer: A

 

 

QUESTION 45

Given the class definitions:

 

clip_image002

 

And the code fragment of the main() method,

 

clip_image004

 

What is the result?

 

A.

Java

Java

Java

B.

Java

Jeve

va

C.

Java

Jeve

ve

D.

Compilation fails

 

Correct Answer: D

 

 

QUESTION 46

Given:

 

clip_image006

 

What is the result?

 

A.

hEllOjAvA!

B.

Hello java!

C.

Out of limits

hEllOjAvA!

D.

Out of limits

 

Correct Answer: C

 

 

QUESTION 47

Given the code fragment:

 

BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2;//line n1

 

System.out.println(val.apply(10, 10.5));

 

What is the result?

 

A.

20

B.

20.5

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

 

Correct Answer: C

 

 

QUESTION 48

Given:

 

Book.java:

 

public class Book {

 

private String read(String bname) { return “Read” + bname }

 

}

 

EBook.java:

 

public class EBook extends Book {

 

public class String read (String url) { return “View” + url }

 

}

 

Test.java:

 

public class Test {

 

public static void main (String[] args) {

 

Book b1 = new Book();

 

b1.read(“Java Programing”);

 

Book b2 = new EBook();

 

b2.read(“http://ebook.com/ebook”);

 

}

 

}

 

What is the result?

A.

Read Java Programming

View http:/ ebook.com/ebook

B.

Read Java Programming

Read http:/ ebook.com/ebook

C.

The EBook.java file fails to compile.

D.

The Test.java file fails to compile.

 

Correct Answer: D

 

 

QUESTION 49

Given the code fragment:

 

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

 

Correct Answer: C

 

 

QUESTION 50

Given the code fragment:

 

String str = “Java is a programming language”;

 

ToIntFunction<String> indexVal = str: : indexOf; //line n1

 

int x = indexVal.applyAsInt(“Java”);//line n2

 

System.out.println(x);

 

What is the result?

 

A.

0

B.

1

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

 

Correct Answer: A

100% Free Download!
—Download Free Demo:1Z0-809 Demo PDF
100% Pass Guaranteed!
Download 2017 Ensurepass 1Z0-809 Full Exam PDF and VCE Q&As:128
—Get 10% off your purchase! Copy it:TJDN-947R-9CCD [2017.07.01-2017.07.31]

Ensurepass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
PDF + VCE Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

2017 Ensurepass IT Certification PDF and VCE