Free preview mode
Enjoy the free questions and consider upgrading to gain full access!
1z0-819
Free trial
Verified
Question 26
Given:
You want to calculate the average of the Player’s score.
Which statement inserted on line 1 will accomplish this?
- A: players.stream().average().orElse(0.0);
- B: players.stream().mapToInt(a -> a.score).average().orElse(0.0);
- C: players.stream().mapToDouble(a -> a.score).average();
- D: players.stream().map(a -> a.score).average();
Question 27
Which two expressions create a valid Java Path instance? (Choose two.)
- A: Paths.get("foo")
- B: Paths.getPath("too")
- C: Path.get(new URI("file:///domains/oracle/test.txt"))
- D: new Path("foo")
- E: Paths.get(URL.create("file:///domains/oracle/test.txt"))
Question 28
Given the code fragment:
How many lines of text does this program print?
- A: four
- B: one
- C: three
- D: two
Question 29
Given the code fragment:
What is the result?
- A: 2
- B: -1
- C: 1
- D: -3
Question 30
Which statement is true?
- A: PrintWriter outputs characters and automatically flushes the stream.
- B: System.exit() invokes the close() method for the InputStream/OutputStream resources.
- C: Console.readPassword() method encrypts the text entered.
- D: PrintStream outputs only bytes.
Question 31
Given:
Which one is correct?
- A: An IllegalThreadStateException is thrown at runtime.
- B: The compilation falls.
- C: Four threads are created.
- D: Three threads are created.
Question 32
Given the code fragment:
and
module greeting
Which statement is true?
- A: All members of com.name are accessible only to the citizen and greeting modules.
- B: public members in the com.name package are accessible only to the greeting module.
- C: Inserting "requires citizen" at greeting's module-info.java, enables com.name members accessible to the greeting module.
- D: All members in the com.name package are accessible only to the greeting module.
- E: public members in the com.name package are accessible to all modules.
Question 33
Which two commands are used to identify class and module dependencies? (Choose two.)
- A: java --show-module-resolution
- B: jmod describe
- C: java Hello.java
- D: jdeps --list-deps
- E: jar --show-module-resolution
Question 34
Given:
and
Which code fragment, when inserted on line 1, gives the number of employees who were born after January 1, 1989 and have a salary greater than 25?
- A:
- B:
- C:
- D:
Question 35
Why would you choose to use a peek operation instead of a forEach operation on a Stream?
- A: to process the current item and return void
- B: to remove an item from the end of the stream
- C: to process the current item and return a stream
- D: to remove an item from the beginning of the stream
Question 36
Given the data of the EMP table:
Assuming that jdbcURL, username, and password are declared and initialised.
Which two happen upon execution? (Choose two.)
- A: Three SQL statements are executed.
- B: Two PreparedStatement objects are created.
- C: Two SQL statements are executed.
- D: Memory leaks because Connection, PreparedStatements, and ResultSet are not closed.
- E: Three PreparedStatement objects are created.
- F: A SQLException is thrown because the ResultSet is not closed.
Question 37
Given:
What is the result?
- A: a b c followed by an exception
- B: a b c null
- C: a b c
- D: a b followed by an exception
Question 38
Which three initialization statements are valid? (Choose three.)
- A: var loc = Arrays.of(“UK”, “US”, “ES”);
- B: var loc = List.of(“UK”, “US”);
- C: var loc = List.of(“UK”, null, “US”);
- D: var loc = Map.of(“UK”, 1, “US”, 2);
- E: var loc = ArrayList.of(“UK”, “US”);
- F: var loc = Set.of(“UK”, “US”, “UK”);
- G: var loc = Set.of(“UK”, “US”);
Question 39
Given this declaration:
@Target(TYPE)
@interface Resource
For which two kinds of declarations can the @Resource annotation be applied? (Choose two.)
- A: An interface declaration
- B: A local variable declaration
- C: A class declaration
- D: A method declaration
- E: A field declaration
Question 40
Given:
and
What is the output?
- A: Base class
- B: The compilation fails.
- C: Derived class
- D: An exception Is thrown at runtime.
Question 41
Given:
Which statement will refactor line 2 to use a lambda expression?
- A: fruits.sort((String d, String e) -> (e.compareTo(d);));
- B: fruits.sort( o, p -> p.compareTo(o));
- C: fruits.sort((String x, y) -> (return y.compareTo(x)));
- D: fruits.sort((a, b) -> (return b.compareTo(a);));
Question 42
Given:
What is the result?
- A: 3.0
- B: The program prints nothing
- C: 2.0
- D: 1.0
- E: An exception is thrown at runtime
Question 43
Given:
and
- A: Hello world! *** NoSuchMethodError
- B: Bonjour le monde! Bonjour le monde! Bonjour le monde!
- C: Hello world! Bonjour le monde! Bonjour le monde!
- D: Hello world! Hello world! Hello world!
- E: Hello world! Bonjour le monde! Bonjour le monde!
That’s the end of your free questions
You’ve reached the preview limit for 1z0-819Consider upgrading to gain full access!
Free preview mode
Enjoy the free questions and consider upgrading to gain full access!