[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-809 Dumps with VCE and PDF 11-20

By | January 25, 2018

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

Given:

public class product {

int id; int price;

public Product (int id, int price) { this.id = id;

this.price = price;

}

public String toString() { return id “:” price; }

}

and the code fragment:

Listlt;Productgt; products = Arrays.asList(new Product(1, 10), new Product (2, 30),

new Product (2, 30));

Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -gt; { p1.price =p2.price;

return new Product (p1.id, p1.price);}); products.add(p); products.stream().parallel()

.reduce((p1, p2) – gt; p1.price gt; p2.price ? p1 : p2)

.ifPresent(System.out: :println); What is the result?

A. 2 : 30

B. 4 : 0

C. 4 : 60

D. 4 : 60

2 : 30

3 : 20

1 : 10

  • The program prints nothing.

  • Answer: D

    Question No: 12

    Given the code fragment:

    Listlt;Integergt; values = Arrays.asList (1, 2, 3); values.stream ()

    .map(n -gt; n*2)//line n1

    .peek(System.out::print)//line n2

    .count();

    What is the result?

    A. 246

    1. The code produces no output.

    2. A compilation error occurs at line n1.

    3. A compilation error occurs at line n2.

    Answer: A

    Question No: 13

    Given the code fragments:

    Ensurepass 2018 PDF and VCE

    What is the result?

    1. Super Sub

      Sub

    2. Contract Contract Super

    3. Compilation fails at line n1

    4. Compilation fails at line n2

    Answer: D

    Question No: 14

    Given the content of /resourses/Message.properties: welcome1=”Good day!”

    and given the code fragment:

    Properties prop = new Properties ();

    FileInputStream fis = new FileInputStream (“/resources/Message.properties”); prop.load(fis);

    System.out.println(prop.getProperty(“welcome1”)); System.out.println(prop.getProperty(“welcome2”, “Test”));//line n1 System.out.println(prop.getProperty(“welcome3”));

    What is the result?

    1. Good day!

      Test

      followed by an Exception stack trace

    2. Good day!

      followed by an Exception stack trace

    3. Good day!

      Test null

    4. A compilation error occurs at line n1.

    Answer: D

    Question No: 15

    Given:

    Class A { } Class B { }

    Interface X { } Interface Y { }

    Which two definitions of class C are valid?

    1. Class C extends A implements X { }

    2. Class C implements Y extends B { }

    3. Class C extends A, B { }

    4. Class C implements X, Y extends B { }

    5. Class C extends B implements X, Y { }

    Answer: A,E

    Explanation: extends is for extending a class.

    implements is for implementing an interface.

    Java allows for a class to implement many interfaces.

    Question No: 16

    Which statement is true about java.util.stream.Stream?

    1. A stream cannot be consumed more than once.

    2. The execution mode of streams can be changed during processing.

    3. Streams are intended to modify the source data.

    4. A parallel stream is always faster than an equivalent sequential stream.

    Answer: B

    Question No: 17

    Given:

    interface Rideable {Car getCar (String name); } class Car {

    private String name; public Car (String name) { this.name = name;

    }

    }

    Which code fragment creates an instance of Car?

    1. Car auto = Car (“MyCar”): : new;

    2. Car auto = Car : : new;

      Car vehicle = auto : : getCar(“MyCar”);

    3. Rideable rider = Car : : new;

      Car vehicle = rider.getCar(“MyCar”);

    4. Car vehicle = Rideable : : new : : getCar(“MyCar”);

    Answer: C

    Question No: 18

    Given the code fragments:

    class Caller implements Callablelt;Stringgt; { String str;

    public Caller (String s) {this.str=s;}

    public String call()throws Exception { return str.concat (“Caller”);}

    }

    class Runner implements Runnable { String str;

    public Runner (String s) {this.str=s;}

    public void run () { System.out.println (str.concat (“Runner”));}

    }

    and

    public static void main (String[] args) InterruptedException, ExecutionException { ExecutorService es = Executors.newFixedThreadPool(2);

    Future f1 = es.submit (new Caller (“Call”)); Future f2 = es.submit (new Runner (“Run”)); String str1 = (String) f1.get();

    String str2 = (String) f2.get();//line n1 System.out.println(str1 “:” str2);

    }

    What is the result?

    1. The program prints: Run Runner

      Call Caller : null

      And the program does not terminate.

    2. The program terminates after printing: Run Runner

      Call Caller : Run

    3. A compilation error occurs at line n1.

    4. An Execution is thrown at run time.

    Answer: A

    Question No: 19

    Given:

    class Book { int id;

    String name;

    public Book (int id, String name) { this.id = id;

    this.name = name;

    }

    public boolean equals (Object obj) { //line n1 boolean output = false;

    Book b = (Book) obj;

    if (this.name.equals(b name))} output = true;

    }

    return output;

    }

    }

    and the code fragment:

    Book b1 = new Book (101, “Java Programing”); Book b2 = new Book (102, “Java Programing”);

    System.out.println (b1.equals(b2)); //line n2 Which statement is true?

    1. The program prints true.

    2. The program prints false.

    3. A compilation error occurs. To ensure successful compilation, replace line n1 with: boolean equals (Book obj) {

    4. A compilation error occurs. To ensure successful compilation, replace line n2 with: System.out.println (b1.equals((Object) b2));

    Answer: C

    Question No: 20

    Given the definition of the Vehicle class:

    Class Vehhicle {

    int distance;//line n1 Vehicle (int x) {

    this distance = x;

    }

    public void increSpeed(int time) {//line n2 int timeTravel = time;//line n3

    class Car { int value = 0;

    public void speed () {

    value = distance /timeTravel;

    System.out.println (“Velocity with new speed” value “kmph”);

    }

    }

    new Car().speed();

    }

    }

    and this code fragment:

    Vehicle v = new Vehicle (100); v.increSpeed(60);

    What is the result?

    1. Velocity with new speed

    2. A compilation error occurs at line n1.

    3. A compilation error occurs at line n2.

    4. A compilation error occurs at line n3.

    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

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