Oracle Certified Professional: Java SE 11 Developer (1Z0-819) — Questions and Answers
Question 1: A method is declared to throw both `java.io.IOException` and `java.sql.SQLException`. Which of the following `catch` clauses is the correct and most concise way to handle both of these distinct exception types in a single block?
- ```java catch (IOException e1, SQLException e2) { /* ... */ } ```
- ```java catch (IOException | SQLException e) { /* ... */ } ``` (Correct answer)
- ```java catch (IOException & SQLException e) { /* ... */ } ```
- ```java catch (Exception e) { /* ... */ } ```
Correct answer: ```java catch (IOException | SQLException e) { /* ... */ } ```
Since Java 7, a single `catch` block can handle multiple exception types using the multi-catch syntax, which separates the exception types with a single vertical bar `|`. The exception variable (`e` in this case) is implicitly final. While catching the superclass `Exception` would also work, it is less specific and therefore not the *best* answer for handling only these two specific types.
Question 2: Which StandardWatchEventKinds constant signals that a new file or directory was created in a directory watched by WatchService?
- ENTRY_CREATED (Correct answer)
- WATCH_CREATE
- FILE_CREATED
- NEW_ENTRY
Correct answer: ENTRY_CREATED
StandardWatchEventKinds.ENTRY_CREATED is the WatchEvent.Kind raised when a new file or directory entry appears in a watched directory.
Question 3: What does Stream.distinct() use internally to remove duplicates?
- compareTo()
- equals() and hashCode() (Correct answer)
- Comparable interface
- == operator
Correct answer: equals() and hashCode()
Stream.distinct() relies on Object.equals() and hashCode() to determine element equality and eliminate duplicates.
Question 4: What is an incremental backup in Oracle?
- It performs full database backups
- It only backs up archived logs
- It only backs up data modified since the last backup (Correct answer)
- It backs up all data, regardless of changes
Correct answer: It only backs up data modified since the last backup
An incremental backup in Oracle only backs up data blocks that have changed since the last full or incremental backup. This strategy significantly reduces the backup window and storage requirements compared to full backups, as it only captures the delta of changes. It's an efficient way to maintain up-to-date backups with minimal overhead.
Question 5: Examine the following code which uses a try-with-resources statement. What is the output when this code is executed? ```java class Door implements AutoCloseable { private String name; public Door(String name) { this.name = name; System.out.println(name + " opened"); } @Override public void close() { System.out.println(name + " closed"); } } public class Test { public static void main(String[] args) { try (Door front = new Door("Front"); Door back = new Door("Back")) { System.out.println("Walking through doors"); } } } ```
- Front opened Back opened Walking through doors Back closed Front closed (Correct answer)
- Front opened Walking through doors Front closed Back opened Back closed
- Front opened Back opened Walking through doors Front closed Back closed
- The code will not compile because multiple resources are declared.
Correct answer: Front opened Back opened Walking through doors Back closed Front closed
In a try-with-resources statement, resources are initialized in the order they are declared. However, they are closed in the reverse order of their declaration. Therefore, 'Front' is opened first, then 'Back'. After the try block executes, 'Back' is closed first, and then 'Front' is closed.
Question 6: In Oracle partitioning, what is 'partition pruning'?
- Compressing unused partitions to reduce I/O
- The optimizer eliminating irrelevant partitions from a query's scan based on the WHERE clause (Correct answer)
- Splitting a large partition into smaller ones automatically
- Dropping old partitions to reclaim space
Correct answer: The optimizer eliminating irrelevant partitions from a query's scan based on the WHERE clause
Partition pruning is an optimization where Oracle reads only the partitions that can satisfy the query's filter conditions, reducing I/O dramatically.
Question 7: Which functional interface has the signature T apply(T t1, T t2)?
- BiFunction<T,T,T>
- BiConsumer<T,T>
- UnaryOperator<T>
- BinaryOperator<T> (Correct answer)
Correct answer: BinaryOperator<T>
BinaryOperator<T> extends BiFunction<T,T,T> and represents an operation on two operands of the same type, producing a result of the same type.
Question 8: How does risk management apply to daily practice in Backup, Recovery & Data Guard for Oracle Certified Professional professionals?
- Through annual safety audits exclusively
- By avoiding high-risk situations entirely
- Through proactive identification of potential hazards and implementation of preventive measures (Correct answer)
- Only through responding to incidents after they occur
Correct answer: Through proactive identification of potential hazards and implementation of preventive measures
Effective risk management in Backup, Recovery & Data Guard requires proactive hazard identification and preventive measures, not just reactive responses. This approach reduces incidents, improves outcomes, and protects both professionals and clients.
Question 9: What does it mean for a class to be 'immutable' in Java?
- It implements the Immutable interface
- It contains only static methods
- Its state cannot be changed after construction (Correct answer)
- It is declared final and cannot be extended
Correct answer: Its state cannot be changed after construction
An immutable class's state cannot be modified after its object is created — typically achieved with final fields and no setters.
Question 10: What does the following code print? ```java PriorityQueue<Integer> pq = new PriorityQueue<>(); pq.offer(5); pq.offer(1); pq.offer(3); System.out.println(pq.poll()); ```
- 5
- 3
- 1 (Correct answer)
- Unpredictable
Correct answer: 1
PriorityQueue is a min-heap by default, so poll() always retrieves the smallest element, which is 1.
Question 11: Which of the following is a valid and most concise lambda expression for a `java.util.function.Predicate<String>` that tests if a string is empty?
- String::isEmpty (Correct answer)
- () -> "".isEmpty()
- s -> s.isEmpty()
- (String s) -> { return s.isEmpty(); }
Correct answer: String::isEmpty
`String::isEmpty` is a method reference, which is a compact form of a lambda expression used to refer to a method without invoking it. In this case, it refers to the `isEmpty()` method of the `String` class. It is functionally equivalent to the lambda `s -> s.isEmpty()` but is generally preferred for its conciseness and clarity when the lambda simply calls an existing method. The other options are also functionally correct but are not the most concise syntax available.
Question 12: Which of the following best describes an 'open module' declared as `open module com.app { }`?
- The module allows cyclic dependencies with other open modules
- All packages in the module are exported for compile-time use by all modules
- All packages are open for deep reflection at runtime by any module (Correct answer)
- The module exports all packages transitively
Correct answer: All packages are open for deep reflection at runtime by any module
An `open module` implicitly opens all its packages for deep reflection at runtime, equivalent to adding `opens` for every package.
Question 13: Which of the following best describes the core difference between intermediate and terminal operations in the Java Stream API?
- Intermediate operations are lazy and return a new stream, while terminal operations are eager and produce a result or side-effect. (Correct answer)
- Terminal operations can only be applied to parallel streams, while intermediate operations work for both sequential and parallel streams.
- Intermediate operations are optional, while every stream pipeline must end with a terminal operation.
- Intermediate operations, like `map()` and `filter()`, can only be chained once, whereas terminal operations can be chained multiple times.
Correct answer: Intermediate operations are lazy and return a new stream, while terminal operations are eager and produce a result or side-effect.
The key distinction lies in their execution behavior. Intermediate operations (e.g., `filter`, `map`, `sorted`) are lazy; they don't execute until a terminal operation is invoked. They build up a pipeline of transformations, each returning a new `Stream`. Terminal operations (e.g., `forEach`, `collect`, `reduce`) are eager, triggering the processing of the entire pipeline and producing a final result, such as a collection, a single value, or a side-effect. Once a terminal operation is called, the stream is considered consumed and cannot be reused.
Question 14: What is the result of the following stream pipeline? ```java long count = Stream.of("apple", "banana", "apricot", "cherry") .filter(s -> s.startsWith("a")) .peek(System.out::println) .count(); ```
- The code will print "apple", "banana", "apricot", and "cherry", and `count` will be 4.
- The code will print nothing, and `count` will be 2.
- The code will not compile because `peek` is a terminal operation.
- The code will print "apple" and "apricot", and `count` will be 2. (Correct answer)
Correct answer: The code will print "apple" and "apricot", and `count` will be 2.
The stream pipeline first filters the elements, keeping only those that start with "a" ("apple", "apricot"). The `peek()` operation is an intermediate operation that performs an action on each element as it passes through the stream; in this case, it prints the element. Since `peek` is an intermediate operation, it doesn't terminate the stream. Finally, the `count()` terminal operation is called, which consumes the stream and returns the number of elements remaining after the filter, which is 2. The `peek` operation will execute for each of those 2 elements.
Question 15: Which method of `BlockingQueue` removes and returns the head element, waiting up to a specified time if necessary?
- peek()
- remove()
- poll(long timeout, TimeUnit unit) (Correct answer)
- take()
Correct answer: poll(long timeout, TimeUnit unit)
`poll(timeout, unit)` waits up to the specified time for an element to become available, returning `null` if the timeout expires.
Question 16: Which statement about TreeMap is correct?
- It maintains keys in insertion order
- It allows one null key by default
- It maintains keys in natural sorted order (Correct answer)
- It is backed by a hash table
Correct answer: It maintains keys in natural sorted order
TreeMap stores keys in their natural ordering (or by a provided Comparator), unlike HashMap which uses hashing.
Question 17: What is the Oracle Redo Log used for?
- To track the changes to the database for recovery (Correct answer)
- To track user login details
- To store temporary session data
- To store archived log files
Correct answer: To track the changes to the database for recovery
The Oracle Redo Log is a crucial component for database recovery and ensuring data integrity. It records all changes made to the database, including transactions, DDL operations, and internal database actions. In case of an instance failure, the redo log files are used to reconstruct committed transactions and recover the database to its most recent consistent state.
Question 18: Which access modifier makes a member visible only within the same package and to subclasses in other packages?
- package-private (no modifier)
- private
- public
- protected (Correct answer)
Correct answer: protected
`protected` grants access within the same package and to subclasses regardless of package.
Question 19: What does List.copyOf(originalList) guarantee in Java 10+?
- A mutable deep copy of originalList
- An unmodifiable list containing the same elements in the same order (Correct answer)
- A synchronized view of originalList
- A lazy copy that reflects future changes to originalList
Correct answer: An unmodifiable list containing the same elements in the same order
List.copyOf() returns an unmodifiable List containing the elements of the given collection in encounter order; mutations to the original do not affect the copy.
Question 20: When using `@Override`, what happens if the method signature does not match any method in the superclass or interface?
- The method overloads the parent method
- The annotation is ignored
- A runtime warning is issued
- A compilation error occurs (Correct answer)
Correct answer: A compilation error occurs
`@Override` causes a compile-time error if the annotated method does not actually override a superclass or interface method.
Question 21: Given `Map<String, List<Integer>> map`, which generic method call compiles without an unchecked warning?
- map.put("k", (List<Integer>) new ArrayList())
- map.put("k", new ArrayList())
- map.put("k", List.of("1", "2"))
- map.put("k", Arrays.asList(1, 2, 3)) (Correct answer)
Correct answer: map.put("k", Arrays.asList(1, 2, 3))
Arrays.asList(1, 2, 3) infers List<Integer> from the declared map type, so no unchecked warning is generated.
Question 22: What is an Oracle database archive log used for?
- To store changes made to the database (Correct answer)
- To log SQL queries
- To store user authentication details
- To track backup processes
Correct answer: To store changes made to the database
Oracle database archive logs (also known as redo log files) store a historical record of all changes made to the database. These logs are crucial for database recovery, allowing the database to be restored to a specific point in time by reapplying transactions. They are essential for point-in-time recovery and maintaining data integrity after a media failure.
Question 23: What is the purpose of exception chaining introduced in Java 1.4?
- To link exceptions across threads
- To create exception hierarchies
- To chain multiple catch blocks together
- To preserve the original cause when wrapping exceptions (Correct answer)
Correct answer: To preserve the original cause when wrapping exceptions
Exception chaining allows you to wrap a low-level exception in a higher-level one while preserving the original cause via initCause() or constructor.
Question 24: What is the effect of using parallel queries in Oracle?
- It reduces network traffic
- It speeds up query processing by using multiple CPUs (Correct answer)
- It reduces the number of database connections
- It optimizes memory usage
Correct answer: It speeds up query processing by using multiple CPUs
Parallel queries in Oracle enable the database to divide a single query's workload among multiple processes or threads, which can then execute simultaneously on different CPUs or cores. This parallel execution significantly speeds up the processing of large, complex queries. It is particularly beneficial in data warehousing environments where large data sets are frequently analyzed.
Question 25: In RMAN, what is the purpose of the CATALOG RECOVERY AREA command?
- Creates the Fast Recovery Area directory
- Re-registers all backup files in the FRA with the RMAN repository after a catalog rebuild (Correct answer)
- Deletes obsolete files from the FRA
- Resizes the recovery area allocation
Correct answer: Re-registers all backup files in the FRA with the RMAN repository after a catalog rebuild
CATALOG RECOVERY AREA scans the Fast Recovery Area and registers any unrecorded backup files back into the RMAN control file or catalog.
Question 26: What is the Oracle instance parameter 'OPTIMIZER_MODE'?
- It specifies the data retention period
- It influences the query optimization strategy (Correct answer)
- It determines the level of parallelism in queries
- It controls the memory allocation
Correct answer: It influences the query optimization strategy
The Oracle instance parameter `OPTIMIZER_MODE` dictates the goal of the query optimizer when generating execution plans. Common modes include `ALL_ROWS` (for best throughput), `FIRST_ROWS_N` (for best response time for the first N rows), and `CHOOSE` (default, lets the optimizer decide). This parameter directly influences how queries are executed, impacting overall performance.
Question 27: When using RMAN with a recovery catalog, what advantage does it provide over using only the control file?
- Stores backup history beyond the CONTROL_FILE_RECORD_KEEP_TIME limit and supports multiple databases (Correct answer)
- Faster backup speeds due to catalog indexing
- Enables block change tracking across databases
- Allows RMAN to bypass operating system file permissions
Correct answer: Stores backup history beyond the CONTROL_FILE_RECORD_KEEP_TIME limit and supports multiple databases
The recovery catalog retains full backup history indefinitely across all databases, unlike the control file which is limited by CONTROL_FILE_RECORD_KEEP_TIME.
Question 28: What does the flatMap() operation do that map() does not?
- It applies a function to each element and returns a new stream of the same size
- It flattens a stream of streams into a single stream (Correct answer)
- It filters elements based on a predicate
- It sorts elements in natural order
Correct answer: It flattens a stream of streams into a single stream
flatMap() maps each element to a stream and then flattens all those streams into a single stream, whereas map() returns one element per input element.
Question 29: A developer needs to create a list of strings that will not be modified after its creation. Which of the following is the most appropriate way to initialize this list in modern Java (9 and later)?
- List<String> list = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("A", "B")));
- List<String> list = new ArrayList<>(); list.add("A"); list.add("B");
- List<String> list = new LinkedList<>(List.of("A", "B"));
- List<String> list = List.of("A", "B"); (Correct answer)
Correct answer: List<String> list = List.of("A", "B");
The `List.of()` factory method, introduced in Java 9, is the most concise and direct way to create an immutable list. The list it returns is unmodifiable, meaning any attempt to add, remove, or change elements will result in an `UnsupportedOperationException`. While `Collections.unmodifiableList` also creates an unmodifiable view, `List.of()` is preferred for its simplicity and efficiency for creating new, constant lists.
Question 30: Which Oracle initialization parameter specifies the size of the System Global Area (SGA) as a whole, allowing Oracle to automatically distribute memory among SGA components?
- PGA_AGGREGATE_TARGET
- DB_CACHE_SIZE
- SGA_TARGET (Correct answer)
- SHARED_POOL_SIZE
Correct answer: SGA_TARGET
SGA_TARGET enables Automatic Shared Memory Management (ASMM), letting Oracle automatically tune SGA component sizes within the specified total.
Question 31: When using `synchronized` on an instance method, which object is used as the monitor lock?
- The thread calling the method
- The instance (`this`) on which the method is called (Correct answer)
- A dedicated lock object created by the JVM
- The class object of the declaring class
Correct answer: The instance (`this`) on which the method is called
An instance `synchronized` method acquires the intrinsic lock on `this`, the object the method is invoked on.
Question 32: Which JVM flag enables assertions for a specific class named `com.example.MyClass`?
- Both A and B are correct (Correct answer)
- -ea com.example.MyClass
- -ea:com.example.MyClass
- -enableassertions:com.example.MyClass
Correct answer: Both A and B are correct
Both -ea and -enableassertions are equivalent flags and can be used with a class name to enable assertions for that specific class.
Question 33: What does the BULK COLLECT clause do in PL/SQL?
- Creates a bulk index on a collection
- Aggregates data from multiple tables
- Inserts multiple rows in one DML statement
- Fetches multiple rows into a collection in a single context switch (Correct answer)
Correct answer: Fetches multiple rows into a collection in a single context switch
BULK COLLECT retrieves multiple rows into a PL/SQL collection in one fetch, reducing context switches between SQL and PL/SQL engines.
Question 34: Which audit policy type in Oracle captures access only when a query returns rows matching a specific condition?
- SYS.AUD$ auditing
- Fine-Grained Auditing (FGA) (Correct answer)
- Mandatory auditing
- Standard auditing
Correct answer: Fine-Grained Auditing (FGA)
Fine-Grained Auditing (FGA) triggers audit records only when query results include rows that satisfy the FGA policy's condition.
Question 35: Which component of Oracle's Program Global Area (PGA) stores bind variable values and the state of a cursor for a specific session?
- Private SQL area (Correct answer)
- Session memory
- Stack space
- Sort area
Correct answer: Private SQL area
The private SQL area within the PGA stores cursor state, bind variable values, and query execution state for each open cursor in a session.
Question 36: Which method correctly obtains the current date using the UTC time zone?
- Instant.now().toLocalDate()
- LocalDate.now(ZoneId.of("UTC")) (Correct answer)
- LocalDate.now()
- ZonedDateTime.now().toLocalDate()
Correct answer: LocalDate.now(ZoneId.of("UTC"))
LocalDate.now(ZoneId.of("UTC")) explicitly passes the UTC zone to get the current date in that zone, whereas the no-arg now() uses the JVM default zone.
Question 37: Which of the following is a key characteristic of the `java.util.Set` interface?
- It does not allow duplicate elements. (Correct answer)
- It allows for duplicate elements.
- It guarantees the order of elements based on insertion time.
- It provides index-based access to its elements via a `get(int index)` method.
Correct answer: It does not allow duplicate elements.
The fundamental contract of the `java.util.Set` interface is that it stores a collection of unique elements. It does not allow duplicate values. Attempting to add an element that is already present in the set will have no effect. Some implementations, like `LinkedHashSet`, may preserve insertion order, but this is not a guarantee of the `Set` interface itself. `Set` is not index-based and does not have a `get(int index)` method.
Question 38: Which of the following is a valid way to create a parallel stream from a List?
- list.stream().toParallel()
- list.parallelStream() (Correct answer)
- Stream.parallel(list)
- Streams.parallel(list)
Correct answer: list.parallelStream()
Collection.parallelStream() is the standard method to obtain a parallel Stream directly from any Collection implementation.
Question 39: A Data Guard standby database is in MOUNTED state. Which command activates it as a primary after a failover?
- ALTER DATABASE OPEN RESETLOGS
- ALTER DATABASE ACTIVATE PRIMARY
- ALTER DATABASE ACTIVATE STANDBY DATABASE (Correct answer)
- ALTER DATABASE FAILOVER TO STANDBY
Correct answer: ALTER DATABASE ACTIVATE STANDBY DATABASE
ALTER DATABASE ACTIVATE STANDBY DATABASE converts the physical standby to a primary and opens it with RESETLOGS.
Question 40: What is printed by: `try { System.exit(0); } finally { System.out.print("finally"); }`?
- Nothing (Correct answer)
- An exception is thrown
- finally
- Compilation error
Correct answer: Nothing
System.exit() terminates the JVM immediately, so the finally block never executes.
Question 41: What is the functional interface type used by Stream.map()?
- Consumer<T>
- UnaryOperator<T>
- Predicate<T>
- Function<T, R> (Correct answer)
Correct answer: Function<T, R>
Stream.map(Function<T,R>) transforms each element of type T into a result of type R using the provided Function.
Question 42: What is the key difference between `ReentrantLock` and `ReentrantReadWriteLock`?
- ReentrantLock allows multiple concurrent readers
- ReadWriteLock allows multiple concurrent readers but only one writer at a time (Correct answer)
- ReadWriteLock is non-reentrant while ReentrantLock is reentrant
- ReadWriteLock does not support condition variables
Correct answer: ReadWriteLock allows multiple concurrent readers but only one writer at a time
`ReentrantReadWriteLock` separates read and write locks, allowing concurrent reads but exclusive writes for better throughput in read-heavy workloads.
Question 43: Which functional interface is used by Stream.filter()?
- Predicate<T> (Correct answer)
- Supplier<T>
- Function<T,R>
- Consumer<T>
Correct answer: Predicate<T>
Stream.filter() accepts a Predicate<T>, which is a functional interface with a single abstract method test(T t) returning boolean.
Question 44: Which standard of practice is MOST important for ensuring quality in Database Architecture & Administration?
- Minimizing documentation to focus on practical work
- Strictly adhering to the same procedure in every situation
- Using the most advanced technology available regardless of need
- Following evidence-based protocols while adapting to specific circumstances (Correct answer)
Correct answer: Following evidence-based protocols while adapting to specific circumstances
Evidence-based protocols provide a foundation of proven practices, but effective Oracle Certified Professional professionals must also adapt their approach based on specific circumstances and individual case needs within Database Architecture & Administration.
Question 45: Which Oracle memory structure holds all the necessary information for managing a user’s session?
- Program Global Area (PGA) (Correct answer)
- Redo log buffer
- Shared pool
- Buffer cache
Correct answer: Program Global Area (PGA)
The Program Global Area (PGA) is a private memory region allocated for each server process or background process. It contains data and control information specific to that process, such as sort areas, hash areas, and cursor state information. For a user session, the PGA holds all the necessary information for managing that specific session's operations and data.
Question 46: What is type erasure in Java generics?
- The compiler removes all generic type information at runtime (Correct answer)
- Generic types are reified and available via reflection at runtime
- Primitive types are automatically boxed in generic contexts
- Wildcard types are resolved to Object at compile time
Correct answer: The compiler removes all generic type information at runtime
Type erasure means the compiler replaces generic type parameters with their bounds (or Object) in bytecode, so type info is unavailable at runtime.
Question 47: What is the result of calling Stream.of(1, 2, 3).reduce(0, Integer::sum)?
- 6 (Correct answer)
- 0
- Optional[6]
- Compilation error
Correct answer: 6
reduce(identity, accumulator) returns the result directly (not wrapped in Optional) because the identity element guarantees a value; 0+1+2+3=6.
Question 48: Which SQL function would you use to return a specified number of characters from the left side of a string?
- EXTRACT(str, 1, n)
- SUBSTR(str, 1, n) (Correct answer)
- LEFT(str, n)
- LEFTSTR
Correct answer: SUBSTR(str, 1, n)
Oracle uses SUBSTR(string, 1, n) to extract n characters starting from position 1, equivalent to LEFT() in other databases.
Question 49: What is the name derived for an automatic module created from a JAR file named `my-library-2.1.0.jar` when no Automatic-Module-Name manifest entry is present?
- mylibrary
- my-library-2.1.0
- my-library
- my.library (Correct answer)
Correct answer: my.library
The JVM strips version numbers and converts hyphens to dots, deriving `my.library` as the automatic module name.
Question 50: Which terminal operation returns true if ALL elements of a stream match a given predicate?
- matchAll(Predicate)
- noneMatch(Predicate)
- anyMatch(Predicate)
- allMatch(Predicate) (Correct answer)
Correct answer: allMatch(Predicate)
Stream.allMatch(Predicate) is a short-circuit terminal operation that returns true only when every element in the stream satisfies the predicate.
Question 51: What does the Collectors.counting() collector return?
- Long (Correct answer)
- int
- Integer
- OptionalLong
Correct answer: Long
Collectors.counting() is equivalent to reducing(0L, e -> 1L, Long::sum) and produces a Long count of the input elements.
Question 52: In a multi-catch block `catch (IOException | SQLException e)`, what is the type of `e`?
- IOException
- Object
- The common supertype of both exceptions (Correct answer)
- SQLException
Correct answer: The common supertype of both exceptions
In a multi-catch, the variable type is the most specific common supertype of all the listed exception types.
Question 53: Which generic wildcard should be used in a method signature `void process(List<?> list)` to allow the method to add `Integer` objects to the list?
- List<? extends Number>
- List<Object>
- List<? super Integer> (Correct answer)
- List<?>
Correct answer: List<? super Integer>
The `? super Integer` wildcard, known as a lower-bounded wildcard, restricts the unknown type to be a supertype of `Integer` (or `Integer` itself). This allows you to safely add `Integer` objects (or subtypes of `Integer`, though `Integer` is final) to the collection, as they will always be compatible with the list's actual type. An upper-bounded wildcard (`? extends T`) is for reading, and an unbounded wildcard (`?`) is also primarily for reading as the compiler cannot guarantee what type is safe to add.
Question 54: Which `javac` flag is required to compile code in a single named module when the module-info.java is in the source root?
- --source-root .
- --module com.mymodule
- --module-version
- --module-source-path . (Correct answer)
Correct answer: --module-source-path .
`--module-source-path .` tells the compiler to find module source directories under the current path, enabling single or multi-module compilation.
Question 55: After an incomplete recovery, which command must be used to open the database?
- ALTER DATABASE OPEN
- ALTER DATABASE OPEN NORESETLOGS
- ALTER DATABASE OPEN RECOVER
- ALTER DATABASE OPEN RESETLOGS (Correct answer)
Correct answer: ALTER DATABASE OPEN RESETLOGS
After incomplete recovery, RESETLOGS is mandatory to reset the log sequence and establish a new incarnation of the database.
Question 56: Given the following code snippet, what is the output? ```java List<String> list = Arrays.asList("a", "b", "c"); Optional<String> result = list.stream() .filter(s -> s.equals("d")) .findFirst(); System.out.println(result.orElse("Not Found")); ```
- null
- A NoSuchElementException is thrown
- An empty Optional
- Not Found (Correct answer)
Correct answer: Not Found
The stream is filtered for the string "d", which does not exist in the list. Therefore, the `filter` operation results in an empty stream. The `findFirst()` terminal operation on an empty stream returns an empty `Optional`. The `orElse("Not Found")` method is then called on this empty `Optional`, which causes it to return the provided default value, "Not Found". A `NoSuchElementException` would only be thrown if `get()` were called on an empty `Optional` without checking for presence.
Question 57: In Oracle Data Guard, what is a 'switchover' operation?
- Converting physical standby to logical standby
- Activating a snapshot standby for testing
- Planned role transition where primary becomes standby and standby becomes primary (Correct answer)
- Unplanned failover after primary crashes
Correct answer: Planned role transition where primary becomes standby and standby becomes primary
A switchover is a planned, graceful role reversal between primary and standby with no data loss, unlike a failover which is unplanned.
Question 58: Which of the following correctly compiles and creates a Map entry stream in Java 8+?
- map.stream()
- Map.stream(map)
- stream(map.entries())
- map.entrySet().stream() (Correct answer)
Correct answer: map.entrySet().stream()
Map does not extend Iterable or Stream directly; you must call entrySet().stream() to stream the Map.Entry objects.
Question 59: What is a 'snapshot standby' database in Oracle Data Guard?
- A point-in-time clone of the primary database
- A read-only standby used for reporting
- A hot standby with zero apply lag
- A standby temporarily opened read-write for testing while accumulating primary redo (Correct answer)
Correct answer: A standby temporarily opened read-write for testing while accumulating primary redo
A snapshot standby is converted to read-write (often using flashback) for testing; it buffers incoming redo and resynchronizes when converted back.
Question 60: Which Oracle initialization parameter, when set to MEMORY_TARGET, enables Automatic Memory Management that tunes both SGA and PGA automatically?
- PGA_AGGREGATE_TARGET
- AMM_ENABLED
- SGA_TARGET
- MEMORY_TARGET (Correct answer)
Correct answer: MEMORY_TARGET
Setting MEMORY_TARGET enables Automatic Memory Management (AMM), where Oracle automatically tunes both SGA and PGA components within the specified total memory limit.
Question 61: What is a key characteristic of a lambda expression captured variable in Java?
- It must be declared with the final keyword
- It must be effectively final (Correct answer)
- It can be freely reassigned inside the lambda
- It must be a class-level field
Correct answer: It must be effectively final
Lambda expressions can capture local variables from the enclosing scope only if those variables are final or effectively final (never reassigned after initialization).
Question 62: Which `ReentrantLock` feature allows a thread to acquire the lock only if it is not held by another thread at the time of invocation?
- lockInterruptibly()
- tryLock() (Correct answer)
- lock()
- newCondition()
Correct answer: tryLock()
`tryLock()` returns `true` immediately if the lock is available or `false` if another thread holds it, without blocking.
Question 63: What is the primary difference between the `Comparable` and `Comparator` interfaces in Java?
- A class can implement multiple `Comparable` interfaces but only one `Comparator`.
- `Comparator` is used for natural ordering, while `Comparable` is used for custom, external sorting logic.
- `Comparable` defines a single, natural ordering for a class, whereas `Comparator` allows for multiple, external sorting strategies. (Correct answer)
- The `compare()` method of `Comparator` takes one argument, while the `compareTo()` method of `Comparable` takes two.
Correct answer: `Comparable` defines a single, natural ordering for a class, whereas `Comparator` allows for multiple, external sorting strategies.
The `Comparable` interface is intended to be implemented by a class to define its 'natural ordering' via the `compareTo()` method. This provides a single, default way to sort objects of that class. The `Comparator` interface, on the other hand, is implemented in a separate class to define custom or multiple sorting strategies. This allows objects to be sorted in different ways without modifying their source code.
Question 64: Which statement about Collectors.toUnmodifiableList() (Java 10+) is correct?
- It returns an immutable List but allows null elements
- It produces a List that throws UnsupportedOperationException on mutation attempts (Correct answer)
- It is identical to Collectors.toList()
- It sorts elements before collecting them
Correct answer: It produces a List that throws UnsupportedOperationException on mutation attempts
Collectors.toUnmodifiableList() collects elements into an unmodifiable List; any attempt to add, remove, or set elements throws UnsupportedOperationException.
Question 65: What does the `assert` statement do when assertions are disabled?
- Evaluates the expression but ignores the result
- Throws AssertionError
- Is completely skipped by the JVM (Correct answer)
- Throws IllegalStateException
Correct answer: Is completely skipped by the JVM
When assertions are disabled (the default), the JVM completely skips the assert statement without evaluating its expression.
Question 66: Which Java keyword prevents a specific field from being included in object serialization?
- static
- abstract
- volatile
- transient (Correct answer)
Correct answer: transient
Fields marked transient are skipped during serialization and will have their default values (null, 0, false) after deserialization.
Question 67: What is the output of: Stream.iterate(1, n -> n * 2).limit(4).reduce(0, Integer::sum)?
- Optional[15]
- 16
- 15 (Correct answer)
- 14
Correct answer: 15
Stream.iterate(1, n->n*2).limit(4) produces [1,2,4,8]; summing with identity 0 gives 1+2+4+8=15.
Question 68: What is the purpose of the RMAN CATALOG command when used with a recovery catalog?
- Registers an RMAN backup file not previously known to the catalog (Correct answer)
- Creates the recovery catalog schema
- Lists all backups stored in the catalog
- Drops old catalog records
Correct answer: Registers an RMAN backup file not previously known to the catalog
CATALOG registers backup files or copies with the recovery catalog so RMAN is aware of them for future restore operations.
Question 69: Which statement correctly describes the difference between HashSet and LinkedHashSet?
- HashSet allows one null; LinkedHashSet does not
- LinkedHashSet sorts elements; HashSet does not
- They are functionally identical with different backing arrays
- LinkedHashSet maintains insertion order; HashSet does not (Correct answer)
Correct answer: LinkedHashSet maintains insertion order; HashSet does not
LinkedHashSet maintains insertion order by using a doubly-linked list alongside the hash table, while HashSet provides no order guarantee.
Question 70: What happens when an exception is thrown inside a try block and no matching catch block exists in the current method?
- The finally block is skipped
- The JVM terminates immediately
- The exception is silently ignored
- The exception propagates up the call stack (Correct answer)
Correct answer: The exception propagates up the call stack
When no matching catch block is found, the exception propagates to the calling method's exception handler.
Question 71: Which Oracle initialization parameter specifies the maximum number of simultaneously open cursors per session?
- OPEN_CURSORS (Correct answer)
- CURSOR_SHARING
- SESSION_CACHED_CURSORS
- CURSOR_SPACE_FOR_TIME
Correct answer: OPEN_CURSORS
OPEN_CURSORS sets the maximum number of open cursors (context areas) a single session can have simultaneously, helping prevent runaway cursor leaks.
Question 72: Which statement about the `java.se` module is TRUE?
- java.se contains all Java SE classes directly
- java.se must be explicitly required by every application module
- java.se replaces java.base as the foundational module in Java 11+
- java.se is an aggregator module that requires transitive all standard Java SE modules (Correct answer)
Correct answer: java.se is an aggregator module that requires transitive all standard Java SE modules
`java.se` is an aggregator module that uses `requires transitive` to group all Java SE API modules, but contains no classes itself.
Question 73: Which Oracle background process performs space management tasks such as coalescing free extents in tablespaces using dictionary extent management?
- CKPT
- PMON
- SMON (Correct answer)
- MMON
Correct answer: SMON
SMON (System Monitor) performs instance recovery at startup and handles space management including coalescing free space in dictionary-managed tablespaces.
Question 74: In what order does Java search for a ResourceBundle named "Messages" when the locale is Locale("fr", "FR")?
- Messages_fr.properties → Messages_fr_FR.properties → Messages.properties
- Messages.properties → Messages_fr.properties → Messages_fr_FR.properties
- Messages_fr_FR.properties → Messages_fr.properties → Messages.properties (Correct answer)
- Messages_FR.properties → Messages_fr_FR.properties → Messages.properties
Correct answer: Messages_fr_FR.properties → Messages_fr.properties → Messages.properties
Java searches from most-specific to least-specific: full locale (fr_FR), language only (fr), then the default bundle — stopping at the first match found.
Question 75: A legacy JAR file named `legacy-utils.jar`, which does not contain a `module-info.class` descriptor, is placed on the module path at runtime. How will the Java Platform Module System treat this JAR?
- It will be ignored by the module system, and its classes will be unavailable.
- It will be treated as an 'automatic module' with a name derived from the JAR file, and it will export all of its packages. (Correct answer)
- It will be part of the 'unnamed module' and its packages will be available to all other modules.
- The application will fail to start because a JAR on the module path must contain a `module-info.class`.
Correct answer: It will be treated as an 'automatic module' with a name derived from the JAR file, and it will export all of its packages.
To support migration and backward compatibility, any non-modular JAR placed on the module path becomes an automatic module. The module system derives a module name from the JAR's filename (e.g., `legacy.utils`), and this module automatically exports all of its packages and can read every other module on the path.
Question 76: Which RMAN command is used to validate a backup without actually restoring it?
- CHECK BACKUP
- RESTORE DATABASE VALIDATE (Correct answer)
- RESTORE VALIDATE
- VALIDATE BACKUPSET
Correct answer: RESTORE DATABASE VALIDATE
RESTORE DATABASE VALIDATE checks whether backups exist and are usable without writing any data files.
Question 77: What is the result of adding a duplicate element to a HashSet?
- The add() method returns false and the set remains unchanged (Correct answer)
- The set grows to hold both copies
- The duplicate replaces the original element
- It throws an IllegalArgumentException
Correct answer: The add() method returns false and the set remains unchanged
Set.add() returns false without modifying the set when the element already exists (as determined by equals() and hashCode()).
Question 78: What does the RMAN command CROSSCHECK BACKUP do?
- Removes expired backup records from the catalog
- Compares two backup sets for differences
- Validates the internal consistency of backup blocks
- Verifies that backup files in the repository still exist on disk or tape (Correct answer)
Correct answer: Verifies that backup files in the repository still exist on disk or tape
CROSSCHECK BACKUP reconciles the RMAN repository with actual backup files, marking missing files as EXPIRED.
Question 79: Which of the following statements about EnumSet is correct?
- EnumSet uses a hash table internally and allows null elements
- EnumSet allows mixing of multiple enum types
- EnumSet is implemented as a bit vector and only holds enum constants (Correct answer)
- EnumSet is synchronized by default
Correct answer: EnumSet is implemented as a bit vector and only holds enum constants
EnumSet is internally represented as a bit vector (RegularEnumSet or JumboEnumSet), making it extremely compact and fast for enum constants.
Question 80: Which SQL clause would you add to prevent phantom reads in a query used inside a long-running PL/SQL procedure?
- AS OF SCN (Correct answer)
- FOR UPDATE
- LOCK TABLE
- WITH READ ONLY
Correct answer: AS OF SCN
AS OF SCN (or AS OF TIMESTAMP) queries Flashback data at a specific point in time, ensuring a consistent read snapshot throughout the procedure.
Oracle Certified Professional: Java SE 11 Developer (1Z0-819)
This certification validates expertise in Java SE 11 programming language, including object-oriented programming, concurrency, and functional programming.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds
These practice questions were written with AI tools. They are not real exam questions. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- oracle.com — Test dates, score release, retake policy · verified Oct 2026
- mylearn.oracle.com — Test delivery, exam format, passing score, time limit · verified Oct 2026