1z0-819 Practice Test

1z0-819 Practice Test practice questions, page 3 of 9, with answer review and explanations.

Question 11

Which module-info.java is correct for a service provider for a print service defined in the PrintServiceAPI module?

  1. module PrintServiceProvider { requires PrintServiceAPI; exports org.printservice.spi; }
  2. module PrintServiceProvider { requires PrintServiceAPI; provides org.printservice.spi.Print with com.provider.PrintService; }
  3. module PrintServiceProvider { requires PrintServiceAPI; uses com.provider.PrintService; }
  4. module PrintServiceProvider { requires PrintServiceAPI; exports org.printservice.spi.Print with com.provider.PrintService; }

Question 12

Given the code fragment: What is the result?

  1. EUR -> 0.84 - GBP -> 0.75 - USD -> 1.00 - CNY -> 6.42
  2. The compilation fails.
  3. CNY -> 6.42 - EUR -> 0.84 - GBP -> 0.75 - USD -> 1.00
  4. USD -> 1.00 - GBP -> 0.75 - EUR -> 0.84 - CNY -> 6.42

Question 13

Why would you choose to use a peek operation instead of a forEach operation on a Stream?

  1. to process the current item and return void
  2. to remove an item from the end of the stream
  3. to process the current item and return a stream
  4. to remove an item from the beginning of the stream

Question 14

Given: What is the result?

  1. abcd
  2. The compilation fails.
  3. adf
  4. abd
  5. abdf

Question 15

Given the code fragment: List list = List.of(11,12,13,12,13); Which statement causes a compile time error?

  1. Double d = list.get(0);
  2. double f = list.get(0);
  3. Integer a = Integer.valueOf(list.get(0));
  4. Integer b = list.get(0);
  5. int c = list.get(0);
  6. Double e = Double.valueOf(list.get(0));