web analytics

100% Pass Guarantee PassLeader 1Z0-809 Dumps with VCE and PDF for Free (Question 51 – Question 60)

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 51
Given:
1. abstract class Shape {
2. Shape ( ) { System.out.println (“Shape”); }
3. protected void area ( ) { System.out.println (“Shape”); }
4. }
5.
6. class Square extends Shape {
7. int side;
8. Square int side {
9./* insert code here */
10. this.side = side;
11. }
12. public void area ( ) { System.out.println (“Square”); }
13. }
14. class Rectangle extends Square {
15. int len, br;
16. Rectangle (int x, int y) {
17. /* insert code here */
18. len = x, br = y;
19. }
20. void area ( ) { System.out.println (“Rectangle”); }
21. }
Which two modifications enable the code to compile? (Choose two.)

A.    At line 1, remove:
abstract
B.    At line 9, insert:
super ( );
C.    At line 12, remove:
public
D.    At line 17, insert:
super (x);
E.    At line 17, insert:
super (); super.side = x;
F.    At line 20, use:
public void area ( ) {

Answer: CD

QUESTION 52
Given:
class Bird {
public void fly () { System.out.print(“Can fly”); }
}
class Penguin extends Bird {
public void fly () { System.out.print(“Cannot fly”); }
}
and the code fragment:
class Birdie {
public static void main (String [ ] args) {
fly( ( ) -> new Bird ( ));
fly (Penguin : : new);
}
/* line n1 */
}
Which code fragment, when inserted at line n1, enables the Birdie class to compile?

A.    static void fly (Consumer<Bird> bird) {
bird :: fly ();
}
B.    static void fly (Consumer<? extends Bird> bird) { bird.accept( ) fly ();
}
C.    static void fly (Supplier<Bird> bird) {
bird.get( ) fly ();
}
D.    static void fly (Supplier<? extends Bird> bird) { LOST

Answer: C

QUESTION 53
Given:
class Student {
String course, name, city;
public Student (String name, String course, String city) {
this.course = course; this.name = name; this.city = city;
}
public String toString() {
return course + “:” + name + “:” + city;
}
and the code fragment:
List<Student> stds = Arrays.asList(
new Student (“Jessy”, “Java ME”, “Chicago”),
new Student (“Helen”, “Java EE”, “Houston”),
new Student (“Mark”, “Java ME”, “Chicago”));
stds.stream()
.collect(Collectors.groupingBy(Student::getCourse))
.forEach(src, res) -> System.out.println(scr));
What is the result?

A.    [Java EE: Helen:Houston]
[Java ME: Jessy:Chicago, Java ME: Mark:Chicago]
B.    Java EE
Java ME
C.    [Java ME: Jessy:Chicago, Java ME: Mark:Chicago] [Java EE: Helen:Houston]
D.    A compilation error occurs

Answer: C

QUESTION 54
Given:
class Worker extends Thread {
CyclicBarrier cb;
public Worker(CyclicBarrier cb) { this.cb = cb; }
public void run () {
try {
cb.await();
System.out.println(“Worker…”);
} catch (Exception ex) { }
}
}
class Master implements Runnable { //line n1
public void run () {
System.out.println(“Master…”);
}
}
and the code fragment:
Master master = new Master();
//line n2
Worker worker = new Worker(cb);
worker.start();
You have been asked to ensure that the run methods of both the Worker and Master classes are executed. Which modification meets the requirement?

A.    At line n2, insert:
CyclicBarrier cb = new CyclicBarrier(2, master);
B.    Replace line n1 with:
class Master extends Thread {
C.    At line n2, insert:
CyclicBarrier cb = new CyclicBarrier(1, master);
D.    At line n2, insert:
CyclicBarrier cb = new CyclicBarrier(master);

Answer: B

QUESTION 55
Given:
passleader-1Z0-809-dumps-551

A.    ns = 50 S = 125
ns = 125 S = 125
ns = 100 S = 125
B.    ns = 50 S = 125
ns = 125 S = 125
ns = 0 S = 125
C.    ns = 50 S = 50
ns = 125 S = 125
ns = 100 S = 100
D.    ns = 50 S = 50
ns = 125 S = 125
ns = 0 S = 125

Answer: B

QUESTION 56
Given the code fragment:
public class Foo {
public static void main (String [ ] args) {
Map<Integer, String> unsortMap = new HashMap< > ( );
unsortMap.put (10, “z”);
unsortMap.put (5, “b”);
unsortMap.put (1, “d”);
unsortMap.put (7, “e”);
unsortMap.put (50, “j”);
Map<Integer, String> treeMap = new TreeMap <Integer, String> (new Comparator<Integer> ( ) {
@Override public int compare (Integer o1, Integer o2) {return o2.compareTo
(o1); } } );
treeMap.putAll (unsortMap);
for (Map.Entry<Integer, String> entry : treeMap.entrySet () ) {
System.out.print (entry.getValue () + ” “);
}
}
}
What is the result?

A.    A compilation error occurs
B.    d b e z j
C.    j z e b d
D.    z b d e j

Answer: C

QUESTION 57
Given the code fragments:
class Employee {
Optional<Address> address;
Employee (Optional<Address> address) {
this.address = address;
}
public Optional<Address> getAddress() { return address; }
}
class Address {
String city = “New York”;
public String getCity { return city: }
public String toString() {
return city;
}
}
and
Address address = null;
Optional<Address> addrs1 = Optional.ofNullable (address);
Employee e1 = new Employee (addrs1);
String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not
available”;
What is the result?

A.    New York
B.    City Not available
C.    null
D.    A NoSuchElementException is thrown at run time

Answer: C

QUESTION 58
Given the code fragment:
passleader-1Z0-809-dumps-581
What is the result?

A.    Found Red
Found Default
B.    Found Teal
C.    Found Red
Found Blue
Found Teal
D.    Found Red
Found Blue
Found Teal
Found Default
E.    Found Default

Answer: B

QUESTION 59
Given:
passleader-1Z0-809-dumps-591
What is the result?

A.    0
Done
B.    First Exception
Done
C.    Second Exception
D.    Done
Third Exception
E.    Third Exception

Answer: B

QUESTION 60
Given the code fragment:
public void recDelete (String dirName) throws IOException {
File [ ] listOfFiles = new File (dirName) .listFiles();
if (listOfFiles ! = null && listOfFiles.length >0) {
for (File aFile : listOfFiles) {
if (aFile.isDirectory ()) {
recDelete (aFile.getAbsolutePath ());
} else {
if (aFile.getName ().endsWith (“.class”))
aFile.delete ();
}
}
}
}
Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.
What is the result?

A.    The method deletes all the .class files in the Projects directory and its subdirectories.
B.    The method deletes the .class files of the Projects directory only.
C.    The method executes and does not make any changes to the Projects directory.
D.    The method throws an IOException.

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