Ensurepass.com : Ensure you pass the IT Exams
2018 Jan 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?
-
square…
-
circle…
-
squarecircle…
-
Compilation fails.
Answer: C
Question No: 42
Given the code fragment:
What is the result?
-
20
-
25
-
29
-
Compilation fails
-
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?
-
.sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing(Emp::getlName))
-
.sorted (Comparator.comparing(Emp::getfName).thenComparing(Emp::getlName))
-
.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?
-
[A Guide to Java Tour:3, Beginning with Java:2]
-
[Beginning with Java:2, A Guide to Java Tour:3]
-
A compilation error occurs because the Book class does not override the abstract method compareTo().
-
An Exception is thrown at run time.
Answer: A
Question No: 45
Given the class definitions:
And the code fragment of the main() method,
What is the result?
-
Java Java Java
-
Java Jeve va
-
Java Jeve ve
-
Compilation fails
Answer: D
Question No: 46
Given:
What is the result?
-
hEllOjAvA!
-
Hello java!
-
Out of limits hEllOjAvA!
-
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
-
A compilation error occurs at line n1.
-
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?
-
Read Java Programming View http:/ ebook.com/ebook
-
Read Java Programming Read http:/ ebook.com/ebook
-
The EBook.java file fails to compile.
-
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?
-
nums.stream().max(Comparator.comparing(a -gt; a)).get()
-
nums.stream().max(Integer : : max).get()
-
nums.stream().max()
-
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?
-
0
-
1
-
A compilation error occurs at line n1.
-
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 |
100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF