Question 11
Which module-info.java is correct for a service provider for a print service defined in the PrintServiceAPI module?
- module PrintServiceProvider { requires PrintServiceAPI; exports org.printservice.spi; }
- module PrintServiceProvider { requires PrintServiceAPI; provides org.printservice.spi.Print with com.provider.PrintService; }
- module PrintServiceProvider { requires PrintServiceAPI; uses com.provider.PrintService; }
- module PrintServiceProvider { requires PrintServiceAPI; exports org.printservice.spi.Print with com.provider.PrintService; }
Question 12
Given the code fragment: What is the result?
- EUR -> 0.84 - GBP -> 0.75 - USD -> 1.00 - CNY -> 6.42
- The compilation fails.
- CNY -> 6.42 - EUR -> 0.84 - GBP -> 0.75 - USD -> 1.00
- 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?
- to process the current item and return void
- to remove an item from the end of the stream
- to process the current item and return a stream
- to remove an item from the beginning of the stream
Question 14
Given: What is the result?
- abcd
- The compilation fails.
- adf
- abd
- abdf
Question 15
Given the code fragment: List list = List.of(11,12,13,12,13); Which statement causes a compile time error?
- Double d = list.get(0);
- double f = list.get(0);
- Integer a = Integer.valueOf(list.get(0));
- Integer b = list.get(0);
- int c = list.get(0);
- Double e = Double.valueOf(list.get(0));