Free 1Z0-819 sample questions
Real questions from the Java SE 11 Developer (OCP) practice bank, with the correct answer and an explanation for each one. No junk, no filler.
Try them in the simulator Same questions, with study, timed and flashcard modes.
Showing 10 of 20 free sample questions.
True or False: In a `try-with-resources` statement that manages multiple resources, the `close()` methods are called in the reverse order of their declaration.
A financial application processes transactions concurrently using a `java.util.concurrent.ExecutorService`. To monitor performance, the team needs to know the total processing time of all completed tasks. Each task is a `Callable ` that returns its execution duration in milliseconds. Which code snippet correctly uses the stream API to invoke all tasks and sum their results?
A developer is writing a utility method to format currency values for different regions. The method should take a `double` and a `java.util.Locale` and return a formatted string. The application will be used in the US, Germany, and Japan. Which is the correct way to instantiate and use a `NumberFormat` object for this purpose?
Given the following code: ```java public class Device { private String type = "electronic"; public String getType() { return type; } } public class Phone extends Device { private String type = "mobile"; @Override public String getType() { return type; } } public class Tester { public static void main(String[] args) { Device device = new Phone(); System.out.println(device.type + ":" + device.getType()); } } ``` What is the result?
A developer needs to process a list of `Order` objects. The goal is to create a `Map` where keys are the `Customer` associated with the order, and values are a `List` of all `Order` objects for that customer. Which stream operation correctly achieves this? graph TD A[List ] --> B{Stream Pipeline} B --> C[Map >]
A developer has created a custom annotation `@Version` to track the version of a class. The annotation must be available at runtime via reflection and should be included in the generated Javadoc. ```java // line n1 public @interface Version { String value(); } ``` Which meta-annotations should be placed at `line n1` to meet these requirements? (Select TWO)
A developer is implementing a custom collection class that must be usable in a `for-each` loop. Which interface must the custom class implement to support this functionality?
What is the output of the following code snippet? ```java var list = new java.util.ArrayList (); list.add("A"); list.add("B"); list.add("C"); for (var s : list) { System.out.print(s); list.remove(s); } ```
A database administrator needs a Java application to connect to an Oracle database. The connection details are: driver `oracle.jdbc.driver.OracleDriver`, URL `jdbc:oracle:thin:@host:1521:sid`, user `scott`, and password `tiger`. Which code fragment correctly establishes a connection to the database?
10 more free samples are waiting
Create a free account to unlock the whole 1Z0-819 sample bank, or get full access to all 235 practice questions in the simulator.