[Free] 2018(Mar) EnsurePass Passguide Oracle 1z0-809 Dumps with VCE and PDF 41-50

Ensurepass.com : Ensure you pass the IT Exams
2018 Mar Oracle Official New Released 1z0-809
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-809.html

Java SE 8 Programmer II

Question No: 41

Given the code fragment:

int b = 3;

if ( !(b gt; 3)) {

System.out.println(quot;square quot;);

}{

System.out.println(quot;circle quot;);

}

System.out.println(quot;…quot;); What is the result?

  1. square…

  2. circle…

  3. squarecircle…

  4. Compilation fails.

Answer: C

Question No: 42

Given the code fragment:

Ensurepass 2018 PDF and VCE

What is the result?

  1. 20

  2. 25

  3. 29

  4. Compilation fails

  5. AnArrayIndexOutOfBoundsException is thrown at runtime

Answer: A

Question No: 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:

Listlt;Empgt; 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?

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

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

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

D.

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

Answer: A

Question No: 44

Given the code fragments:

public class Book implements Comparatorlt;Bookgt; { 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

Listlt;Bookgt;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?

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

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

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

  4. An Exception is thrown at run time.

Answer: A

Question No: 45

Given the class definitions:

Ensurepass 2018 PDF and VCE

And the code fragment of the main() method,

Ensurepass 2018 PDF and VCE

What is the result?

  1. Java Java Java

  2. Java Jeve va

  3. Java Jeve ve

  4. Compilation fails

Answer: D

Question No: 46

Given:

Ensurepass 2018 PDF and VCE

What is the result?

  1. hEllOjAvA!

  2. Hello java!

  3. Out of limits hEllOjAvA!

  4. Out of limits

Answer: C

Question No: 47

Given the code fragment:

BiFunctionlt;Integer, Double, Integergt; val = (t1, t2) -gt; t1 t2;//line n1 System.out.println(val.apply(10, 10.5));

What is the result?

A. 20

B. 20.5

  1. A compilation error occurs at line n1.

  2. A compilation error occurs at line n2.

Answer: C

Question No: 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?

  1. Read Java Programming View http:/ ebook.com/ebook

  2. Read Java Programming Read http:/ ebook.com/ebook

  3. The EBook.java file fails to compile.

  4. The Test.java file fails to compile.

Answer: D

Question No: 49

Given the code fragment:

Listlt;Integergt; 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?

  1. nums.stream().max(Comparator.comparing(a -gt; a)).get()

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

  3. nums.stream().max()

  4. nums.stream().map(a -gt; a).max()

Answer: C

Question No: 50

Given the code fragment:

String str = “Java is a programming language”; ToIntFunctionlt;Stringgt; indexVal = str: : indexOf; //line n1 int x = indexVal.applyAsInt(“Java”);//line n2 System.out.println(x);

What is the result?

  1. 0

  2. 1

  3. A compilation error occurs at line n1.

  4. A compilation error occurs at line n2.

Answer: A

100% Ensurepass Free Download!
Download Free Demo:1z0-809 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-809 Dumps

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.