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

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: 51

Given:

IntStream stream = IntStream.of (1,2,3); IntFunctionlt;Integergt; inFu= x -gt; y -gt; x*y;//line n1

IntStream newStream = stream.map(inFu.apply(10));//line n2 newStream.forEach(System.output::print);

Which modification enables the code fragment to compile?

  1. Replace line n1 with: IntFunctionlt;UnaryOperatorgt; inFu = x -gt; y -gt; x*y;

  2. Replace line n1 with: IntFunctionlt;IntUnaryOperatorgt; inFu = x -gt; y -gt; x*y;

  3. Replace line n1 with: BiFunctionlt;IntUnaryOperatorgt; inFu = x -gt; y -gt; x*y;

  4. Replace line n2 with:

IntStream newStream = stream.map(inFu.applyAsInt (10));

Answer: D

Question No: 52

Given:

Ensurepass 2018 PDF and VCE

Which two classes use the shape class correctly?

Ensurepass 2018 PDF and VCE

  1. Option A

  2. Option B

  3. Option C

  4. Option D

  5. Option E

  6. Option F

Answer: B,E

Explanation: When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class (E). However, if it does not, then the subclass must also be declared abstract (B).

Note: An abstract class is a class that is declared abstract-it may or may not include

abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.

Question No: 53

Given the code fragment:

Path source = Paths.get (“/data/december/log.txt”); Path destination = Paths.get(“/data”);

Files.copy (source, destination);

and assuming that the file /data/december/log.txt is accessible and contains: 10-Dec-2014 – Executed successfully

What is the result?

  1. A file with the name log.txt is created in the /data directory and the content of the

    /data/december/log.txt file is copied to it.

  2. The program executes successfully and does NOT change the file system.

  3. A FileNotFoundException is thrown at run time.

  4. A FileAlreadyExistsException is thrown at run time.

Answer: B

Question No: 54

Given the definition of the Emp class:

public class Emp private String eName; private Integer eAge;

Emp(String eN, Integer eA) { this.eName = eN;

this.eAge = eA;

}

public Integer getEAge () {return eAge;} public String getEName () {return eName;}

}

and code fragment:

Listlt;Empgt;li = Arrays.asList(new Emp(“Sam”, 20), New Emp(“John”, 60), New Emp(“Jim”, 51));

Predicatelt;Empgt; agVal = s -gt; s.getEAge() gt; 50;//line n1 li = li.stream().filter(agVal).collect(Collectors.toList());

Streamlt;Stringgt; names = li.stream()map.(Emp::getEName);//line n2 names.forEach(n -gt; System.out.print(n ” “));

What is the result?

  1. Sam John Jim

  2. John Jim

  3. A compilation error occurs at line n1.

  4. A compilation error occurs at line n2.

Answer: A

Question No: 55

Given the code fragment:

Listlt;Integergt; codes = Arrays.asList (10, 20); UnaryOperatorlt;Doublegt; uo = s -gt; s 10.0;

codes.replaceAll(uo);

codes.forEach(c -gt; System.out.println(c)); What is the result?

A. 20.0

30.0

  1. 10 20

  2. A compilation error occurs.

  3. A NumberFormatException is thrown at run time.

Answer: A

Question No: 56

Given:

public class Canvas implements Drawable { public void draw () { }

}

public abstract class Board extends Canvas { } public class Paper extends Canvas {

protected void draw (int color) { }

}

public class Frame extends Canvas implements Drawable { public void resize () { }

}

public interface Drawable { public abstract void draw ();

}

Which statement is true?

  1. Board does not compile.

  2. Paper does not compile.

  3. Frame does not compile.

  4. Drawable does not compile.

  5. All classes compile successfully.

Answer: B

Question No: 57

Given:

class Sum extends RecursiveAction { //line n1 static final int THRESHOLD_SIZE = 3;

int stIndex, lstIndex; int [ ] data;

public Sum (int [ ]data, int start, int end) { this.data = data;

this stIndex = start; this. lstIndex = end;

}

protected void compute ( ) { int sum = 0;

if (lstIndex – stIndex lt;= THRESHOLD_SIZE) { for (int i = stIndex; i lt; lstIndex; i ) {

sum = data [i];

}

System.out.println(sum);

} else {

new Sum (data, stIndex THRESHOLD_SIZE, lstIndex).fork( ); new Sum (data, stIndex,

Math.min (lstIndex, stIndex THRESHOLD_SIZE)

).compute ();

}

}

}

and the code fragment:

ForkJoinPool fjPool = new ForkJoinPool ( ); int data [ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

fjPool.invoke (new Sum (data, 0, data.length));

and given that the sum of all integers from 1 to 10 is 55. Which statement is true?

  1. The program prints several values that total 55.

  2. The program prints 55.

  3. A compilation error occurs at line n1.

  4. The program prints several values whose sum exceeds 55.

Answer: C

Question No: 58

Given the code fragment:

public class FileThread implements Runnable { String fName;

public FileThread(String fName) { this.fName = fName; } public void run () System.out.println(fName);}

public static void main (String[] args) throws IOException, InterruptedException { ExecutorService executor = Executors.newCachedThreadPool();

Streamlt;Pathgt; listOfFiles = Files.walk(Paths.get(“Java Projects”)); listOfFiles.forEach(line -gt; {

executor.execute(new FileThread(line.getFileName().toString())); // line n1

});

executor.shutdown(); executor.awaitTermination(5, TimeUnit.DAYS);// line n2

}

}

The Java Projects directory exists and contains a list of files. What is the result?

  1. The program throws a runtime exception at line n2.

  2. The program prints files names concurrently.

  3. The program prints files names sequentially.

  4. A compilation error occurs at line n1.

Answer: A

Question No: 59

The data.doc, data.txt and data.xml files are accessible and contain text. Given the code fragment:

Streamlt;Pathgt; paths = Stream.of (Paths. get(“data.doc”), Paths. get(“data.txt”),

Paths. get(“data.xml”));

paths.filter(s-gt; s.toString().endWith(“txt”)).forEach( s -gt; {

try { Files.readAllLines(s)

.stream()

.forEach(System.out::println); //line n1

} catch (IOException e) { System.out.println(“Exception”);

}

}

);

What is the result?

  1. The program prints the content of data.txt file.

  2. The program prints: Exception

    lt;lt;The content of the data.txt filegt;gt; Exception

  3. A compilation error occurs at line n1.

  4. The program prints the content of the three files.

Answer: D

Question No: 60

Given the code fragment:

Path path1 = Paths.get(“/app/./sys/”); Path res1 = path1.resolve(“log”);

Path path2 = Paths.get(“/server/exe/”); Path res1 = path1.resolve(“/readme/”); System.out.println(res1); System.out.println(res2);

What is the result?

  1. /app/sys/log

    /readme/server/exe

  2. /app/log/sys

    /server/exe/readme

  3. /app/./sys/log

    /readme

  4. /app/./sys/log

/server/exe/readme

Answer: D

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.