web analytics

PassLeader 1Z0-809 Exam Dumps Collection with VCE and PDF (Question 41 – Question 50)

PassLeader now are offering 100% pass ensure 1Z0-809 dumps! All 1Z0-809 exam questions have been updated with correct answers, welcome to download the newest PassLeader 1Z0-809 VCE dumps and PDF dumps: https://www.passleader.com/1z0-809.html (132 Q&As –> 201 Q&As)

BTW: Download PassLeader 1Z0-809 dumps from Google Drive for free: https://drive.google.com/open?id=0B-ob6L_QjGLpNTlzOWE4bXRKMmM

QUESTION 41
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

Answer: D

QUESTION 42
Given the code fragments:
class MyThread implements Runnable {
private static AtomicInteger count = new AtomicInteger (0);
public void run () {
int x = count.incrementAndGet();
System.out.print (x+” “);
}
}
and
Thread thread1 = new Thread(new MyThread());
Thread thread2 = new Thread(new MyThread());
Thread thread3 = new Thread(new MyThread());
Thread [] ta = {thread1, thread2, thread3};
for (int x= 0; x < 3; x++) {
ta[x].start();
}
Which statement is true?

A.    The program prints 1 2 3 and the order is unpredictable.
B.    The program prints 1 2 3.
C.    The program prints 1 1 1.
D.    A compilation error occurs.

Answer: B

QUESTION 43
Which three statements are benefits of encapsulation? (Choose three.)

A.    Allows a class implementation to change without changing t he clients
B.    Protects confidential data from leaking out of the objects
C.    Prevents code from causing exceptions
D.    Enables the class implementation to protect its invariants
E.    Permits classes to be combined into the same package
F.    Enables multiple instances of the same class to be created safely

Answer: ABD

QUESTION 44
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?

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

Answer: D

QUESTION 45
Given the for loop construct:
for ( expr1 ; expr2 ; expr3 ) {
statement;
}
Which two statements are true? (Choose two.)

A.    This is not the only valid for loop construct; there exits another form of for loop constructor.
B.    The expression expr1 is optional. It initializes the loop and is evaluated once, as the loop begin.
C.    When expr2 evaluates to false, the loop terminates. It is evaluated only after each iteration through the loop.
D.    The expression expr3 must be present. It is evaluated after each iteration through the loop.

Answer: BC
Explanation:
The for statement have this forms:
for (init-stmt; condition; next-stmt) {
body
}
There are three clauses in the for statement:
– The init-stmt statement is done before the loop is started, usually to initialize an iteration variable.
– The condition expression is tested before each time the loop is done.
– The loop isn’t executed if the boolean expression is false (the same as the while loop).
The next-stmt statement is done after the body is executed. It typically increments an iteration variable.

QUESTION 46
Given:
interface Doable {
public void doSomething (String s);
}
Which two class definitions compile? (Choose two.)

A.    public abstract class Task implements Doable { public void doSomethingElse(String s) { }
}
B.    public abstract class Work implements Doable { public abstract void doSomething(String s) { }
public void doYourThing(Boolean b) { }
}
C.    public class Job implements Doable {
public void doSomething(Integer i) { }
}
D.    public class Action implements Doable {
public void doSomething(Integer i) { }
public String doThis(Integer j) { }
}
E.    public class Do implements Doable {
public void doSomething(Integer i) { }
public void doSomething(String s) { }
public void doThat (String s) { }
}

Answer: CD

QUESTION 47
Given the code fragments:
4. void doStuff() throws ArithmeticException, NumberFormatException, Exception {
5. if (Math.random() >-1 throw new Exception (“Try again”);
6. }
and
24. try {
25. doStuff ( ):
26. } catch (ArithmeticException | NumberFormatException | Exception e) {
27. System.out.println (e.getMessage()); }
28. catch (Exception e) {
29. System.out.println (e.getMessage()); }
30. }
Which modification enables the code to print Try again?

A.    Comment the lines 28, 29 and 30
B.    Replace line 26 with:
} catch (Exception | ArithmeticException | NumberFormatException e) {
C.    Replace line 26 with:
} catch (ArithmeticException | NumberFormatException e) {
D.    Replace line 27 with:
throw e;

Answer: C

QUESTION 48
Given the code fragment:
passleader-1Z0-809-dumps-481
Which code fragment prints blue, cyan?
passleader-1Z0-809-dumps-482

A.    Option A
B.    Option B
C.    Option C
D.    Option D

Answer: A

QUESTION 49
Which statement is true about the single abstract method of the java.util.function.Function interface?

A.    It accepts one argument and returns void.
B.    It accepts one argument and returns boolean.
C.    It accepts one argument and always produces a result of the same type as the argument.
D.    It accepts an argument and produces a result of any data type.

Answer: C
Explanation:
http://winterbe.com/posts/2014/03/16/java-8-tutorial/ (Functions)

QUESTION 50
Given the code fragment:
public static void main (String[] args) throws IOException {
BufferedReader brCopy = null;
try (BufferedReader br = new BufferedReader (new FileReader(“employee.txt”))) { //line n1
br.lines().forEach(c -> System.out.println(c));
brCopy = br;//line n2
}
brCopy.ready();//line n3;
}
Assume that the ready method of the BufferedReader, when called on a closed BufferedReader, throws an exception, and employee.txt is accessible and contains valid text. What is the result?

A.    A compilation error occurs at line n3.
B.    A compilation error occurs at line n1.
C.    A compilation error occurs at line n2.
D.    The code prints the content of the employee.txt file and throws an exception at line n3.

Answer: B


PassLeader now are offering 100% pass ensure 1Z0-809 dumps! All 1Z0-809 exam questions have been updated with correct answers, welcome to download the newest PassLeader 1Z0-809 VCE dumps and PDF dumps: https://www.passleader.com/1z0-809.html (132 Q&As –> 201 Q&As)

BTW: Download PassLeader 1Z0-809 dumps from Google Drive for free: https://drive.google.com/open?id=0B-ob6L_QjGLpNTlzOWE4bXRKMmM