Java SE 11 Developer (1Z0-819) Exam — Questions and Answers
Question 1: What is a named module?
- A module with a defined name in module-info.java (Correct answer)
- A default unnamed module.
- A module imported with wildcards.
- An internal module only.
Correct answer: A module with a defined name in module-info.java
A named module is a module that has a defined name and explicitly declares its dependencies and exported packages in a `module-info.java` file. This contrasts with unnamed modules, which are typically created from classes on the classpath that are not part of a named module. Named modules benefit from the strong encapsulation and explicit dependency management provided by the Java Platform Module System.
Question 2: Which `LocalDate` method adds a specified number of months and adjusts the day if the result month is shorter?
- plusMonths() (Correct answer)
- adjustMonth()
- withMonth()
- addMonths()
Correct answer: plusMonths()
`plusMonths()` adds months and normalizes the day-of-month if the target month has fewer days.
Question 3: Which approach is recommended for troubleshooting modules system issues?
- Rely solely on past experience
- Wait for the problem to resolve itself
- Replace all components simultaneously
- Use systematic isolation and testing methods (Correct answer)
Correct answer: Use systematic isolation and testing methods
Systematic isolation and testing methodically narrows down the root cause, making troubleshooting efficient and accurate.
Question 4: What is the default value of an instance variable of type `boolean` in Java?
- true
- null
- false (Correct answer)
- 0
Correct answer: false
Instance variables of type boolean are initialized to false by default when a class is instantiated.
Question 5: Which professional attribute is most valued in functional interfaces within the 1Z0-819 field?
- Prioritizing personal convenience
- Accountability and commitment to standards (Correct answer)
- Working in isolation
- Avoiding challenging situations
Correct answer: Accountability and commitment to standards
Accountability and commitment to professional standards build trust and ensure consistent, high-quality practice.
Question 6: What does `Comparator.reversed()` do when chained with `Comparator.comparing(Person::getAge)`?
- Reverses the list in place
- Sorts by age in descending order (Correct answer)
- Sorts by age in ascending order
- Throws UnsupportedOperationException
Correct answer: Sorts by age in descending order
reversed() returns a Comparator that imposes the reverse ordering of the original, yielding descending age sort.
Question 7: A Java enum implicitly extends which class?
- java.lang.Comparable
- java.lang.Object
- java.lang.Enum (Correct answer)
- java.io.Serializable
Correct answer: java.lang.Enum
All Java enums implicitly extend `java.lang.Enum`, which is why they cannot extend any other class.
Question 8: What does `Comparator.comparing(Person::getName)` return?
- A Comparator<Person> that orders persons by their name (Correct answer)
- A Consumer<Person> that prints the name
- A Function<Person, String> extracting the name
- A Predicate<Person> that tests name equality
Correct answer: A Comparator<Person> that orders persons by their name
Comparator.comparing accepts a key extractor Function and returns a Comparator that orders by the extracted key's natural order.
Question 9: How is a thread created in Java?
- By creating a new class with void main().
- By extending Thread or implementing Runnable (Correct answer)
- By using the synchronized keyword.
- By calling static methods only.
Correct answer: By extending Thread or implementing Runnable
In Java, there are two primary ways to create a thread: by extending the `java.lang.Thread` class or by implementing the `java.lang.Runnable` interface. Both approaches require defining the code to be executed by the thread within a `run()` method. Extending `Thread` is simpler for single-use cases, while implementing `Runnable` is preferred for better code organization and when the class already extends another class.
Question 10: An interface has one abstract method and one default method. Can it be annotated with `@FunctionalInterface`?
- Only if the default method is declared private
- No — any default method prevents it from being functional
- Only if the abstract method has no parameters
- Yes — default methods do not count toward the single abstract method requirement (Correct answer)
Correct answer: Yes — default methods do not count toward the single abstract method requirement
@FunctionalInterface requires exactly one abstract method; default and static methods do not affect this count.
Question 11: What modifier must a field have to be accessible from a static method in the same class?
- transient
- static (Correct answer)
- final
- public
Correct answer: static
Static methods belong to the class rather than an instance, so they can only directly access fields that are also declared static.
Question 12: Which interface must be implemented to receive notifications from a `WatchService`?
- FileChangeListener
- WatchListener
- Watchable
- No interface — you poll `WatchKey` events from the service (Correct answer)
Correct answer: No interface — you poll `WatchKey` events from the service
`WatchService` is poll-based: you call `take()` or `poll()` on the service to retrieve `WatchKey` objects containing `WatchEvent` lists.
Question 13: Which Collectors method produces a Map<K, Long> counting elements per group?
- Collectors.groupingBy(classifier)
- Collectors.groupingBy(classifier, Collectors.counting()) (Correct answer)
- Collectors.counting()
- Collectors.toMap(k, v -> 1L, Long::sum)
Correct answer: Collectors.groupingBy(classifier, Collectors.counting())
Collectors.groupingBy with a downstream Collectors.counting() produces a Map where each key maps to the count of matching elements.
Question 14: What is the time complexity of `HashMap.get()` in the average case?
- O(n)
- O(log n)
- O(n log n)
- O(1) (Correct answer)
Correct answer: O(1)
`HashMap.get()` has O(1) average-case performance because it computes the hash and directly indexes into the backing array.
Question 15: Which command-line option allows code in an unnamed module to access a specific package in a named module at runtime?
- --patch-module
- --add-exports (Correct answer)
- --add-reads
- --add-opens
Correct answer: --add-exports
`--add-exports` makes a package in a named module accessible to another module (or unnamed module) without modifying `module-info.java`.
Question 16: In 1Z0-819 certification, what is the purpose of automated testing?
- To catch regressions and verify functionality continuously (Correct answer)
- To replace manual code review entirely
- To slow down development
- To increase server costs
Correct answer: To catch regressions and verify functionality continuously
Automated testing catches regressions early and verifies that functionality works as expected, providing confidence in code changes.
Question 17: Which documentation is essential when working with modules system in 1Z0-819?
- General descriptions without specifics
- Only verbal notes
- Detailed technical specifications and as-built diagrams (Correct answer)
- Marketing materials
Correct answer: Detailed technical specifications and as-built diagrams
Detailed technical specifications and as-built diagrams provide the accurate reference information needed for maintenance and troubleshooting.
Question 18: Which of the following correctly relies on type inference for a generic method call?
- List<String> list = Collections.<>emptyList();
- List<String> list = Collections.emptyList(); (Correct answer)
- List<String> list = Collections.emptyList<String>();
- List<String> list = <String>Collections.emptyList();
Correct answer: List<String> list = Collections.emptyList();
The compiler infers the type argument for Collections.emptyList() from the target type List<String> on the left-hand side, so no explicit type witness is needed.
Question 19: What is the output of: `System.out.println(10 / 3);`?
- 3.333
- Compilation error
- 3 (Correct answer)
- 3.0
Correct answer: 3
Integer division truncates the decimal part, so 10 / 3 yields 3.
Question 20: When using `Collections.sort(List<T> list)`, what must type `T` satisfy?
- T must extend Comparator
- T must be a Number subtype
- T must implement Comparable (Correct answer)
- T must be Serializable
Correct answer: T must implement Comparable
`Collections.sort()` requires elements to implement `Comparable<T>` so their natural ordering can be used; otherwise, a `ClassCastException` is thrown at runtime.
Question 21: Which block must always follow a try block?
- do
- switch
- finally (Correct answer)
- loop
Correct answer: finally
In Java's exception handling mechanism, a `try` block must always be followed by either a `catch` block, a `finally` block, or both. The `finally` block is crucial because the code within it is guaranteed to execute, regardless of whether an exception was thrown or caught in the `try` block. This makes it ideal for cleanup operations like closing resources.
Question 22: When using `PreparedStatement`, which method binds a Java `int` value to the first placeholder?
- setInt(0, value)
- bindInt(1, value)
- setInt(1, value) (Correct answer)
- setInteger(1, value)
Correct answer: setInt(1, value)
`PreparedStatement.setInt(1, value)` binds an int to the first `?` placeholder; parameters are 1-indexed and the method is `setInt`, not `setInteger`.
Question 23: What does `BinaryOperator.maxBy(Comparator<T> comparator)` return?
- A static int representing the max value
- A Supplier that returns the max element
- A Comparator that finds the maximum
- A BinaryOperator that returns the greater of two elements according to the comparator (Correct answer)
Correct answer: A BinaryOperator that returns the greater of two elements according to the comparator
BinaryOperator.maxBy returns a BinaryOperator that returns the larger of its two operands as determined by the given Comparator.
Question 24: Which professional attribute is most valued in i/o operations within the 1Z0-819 field?
- Avoiding challenging situations
- Accountability and commitment to standards (Correct answer)
- Prioritizing personal convenience
- Working in isolation
Correct answer: Accountability and commitment to standards
Accountability and commitment to professional standards build trust and ensure consistent, high-quality practice.
Question 25: Which command-line option adds a module to the set of root modules resolved by the module system?
- --patch-module
- --add-opens
- --add-modules (Correct answer)
- --module-path
Correct answer: --add-modules
'--add-modules' explicitly adds one or more modules to the root module set during resolution.
Question 26: Which factor MOST significantly affects the quality of technical outcomes in 1Z0-819 practice?
- The practitioner's training, preparation, and attention to detail (Correct answer)
- The speed at which procedures are completed
- The time of day the procedure is performed
- The brand of equipment being used
Correct answer: The practitioner's training, preparation, and attention to detail
The quality of technical outcomes depends primarily on the practitioner's level of training, thorough preparation, and careful attention to detail. While equipment matters, the professional's competence is the most significant factor.
Question 27: A lambda body attempts to modify a local variable declared in the enclosing method. What happens?
- A compilation error occurs because local variables captured by lambdas must be effectively final (Correct answer)
- The modification is allowed only if the variable is declared volatile
- The JVM creates a new stack frame for the modification
- The variable is silently copied into the lambda
Correct answer: A compilation error occurs because local variables captured by lambdas must be effectively final
Local variables captured by a lambda must be final or effectively final; reassigning them causes a compile-time error.
Question 28: Which method of `PreparedStatement` is used to execute a SQL INSERT and return the number of affected rows?
- executeUpdate() (Correct answer)
- executeQuery()
- execute()
- executeBatch()
Correct answer: executeUpdate()
`executeUpdate()` executes DML statements (INSERT, UPDATE, DELETE) and returns the count of affected rows.
Question 29: What is the most important professional competency for 1Z0-819 certification in collections framework?
- Memorization of all reference materials
- Speed of task completion
- Deep knowledge combined with practical application skills (Correct answer)
- Ability to work alone exclusively
Correct answer: Deep knowledge combined with practical application skills
Professional competency requires both deep knowledge of the subject matter and the ability to apply that knowledge in practical situations.
Question 30: When iterating over a `HashSet` and calling `iterator.remove()`, what is the result?
- Removes the element safely without ConcurrentModificationException (Correct answer)
- Throws ConcurrentModificationException
- Throws UnsupportedOperationException
- Does nothing because HashSet is unordered
Correct answer: Removes the element safely without ConcurrentModificationException
Using the iterator's own `remove()` method is the safe way to remove elements during iteration and does not throw `ConcurrentModificationException`.
Question 31: What is the correct location for module-info.java in a standard Maven project layout?
- META-INF/module-info.java
- src/module/module-info.java
- src/main/java/module-info.java at the root of the source tree (Correct answer)
- src/main/resources/module-info.java
Correct answer: src/main/java/module-info.java at the root of the source tree
module-info.java lives at the root of the module's source tree, directly in src/main/java for Maven projects.
Question 32: What is the output of: `List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); list.remove(1);` — what remains?
- [1, 2]
- [1] (Correct answer)
- Throws IndexOutOfBoundsException
- [2]
Correct answer: [1]
`list.remove(1)` uses the index overload (not the object overload) because the argument is an `int`, removing the element at index 1 (value 2), leaving [1].
Question 33: What is the main purpose of the Java Virtual Machine (JVM)?
- To compile Java source code.
- To store Java libraries.
- To convert Java bytecode to machine code at runtime (Correct answer)
- To write Java programs.
Correct answer: To convert Java bytecode to machine code at runtime
The Java Virtual Machine (JVM) is responsible for executing Java bytecode. After Java source code is compiled into bytecode, the JVM translates this platform-independent bytecode into machine-specific instructions at runtime. This 'write once, run anywhere' capability is a core feature of Java, enabled by the JVM's role as an interpreter and runtime environment.
Question 34: What does Collectors.summarizingInt(ToIntFunction) produce?
- A Map of statistics
- An Integer sum
- An IntSummaryStatistics object (Correct answer)
- An OptionalInt
Correct answer: An IntSummaryStatistics object
summarizingInt() collects count, sum, min, max, and average into an IntSummaryStatistics instance.
Question 35: What does CountDownLatch.await() do when the count reaches zero?
- It cancels all registered tasks
- It resets the count and continues blocking
- It unblocks all waiting threads (Correct answer)
- It throws an exception to signal completion
Correct answer: It unblocks all waiting threads
When countDown() reduces the latch's count to zero, all threads blocked on await() are released simultaneously.
Question 36: Which statement BEST describes the relationship between Oracle Java SE 11 Developer certification requirements and industry evolution?
- Certification requirements never change once established
- Changes only occur when government mandates new requirements
- Requirements evolve periodically to reflect advances in knowledge, technology, and practice standards (Correct answer)
- Requirements become less stringent over time
Correct answer: Requirements evolve periodically to reflect advances in knowledge, technology, and practice standards
Certification requirements evolve to keep pace with advances in professional knowledge, technological developments, and changes in practice standards. This ensures that certified professionals remain current and competent in a changing professional landscape.
Question 37: Which approach is MOST important for 1Z0-819 professionals when applying technical procedures?
- Applying the same technique in every situation without variation
- Using the fastest method available regardless of standards
- Adhering to established protocols while adapting to specific conditions (Correct answer)
- Following personal shortcuts developed through experience
Correct answer: Adhering to established protocols while adapting to specific conditions
Technical procedures require adherence to established protocols as a foundation, with professional judgment to adapt appropriately to specific conditions. This balance ensures both consistency and effectiveness.
Question 38: What does the `--patch-module` JVM flag do?
- Adds classes or resources into an existing named module at runtime (Correct answer)
- Enables reflection on all packages in the specified module
- Replaces a module entirely with a different JAR at runtime
- Downgrades a named module to an automatic module
Correct answer: Adds classes or resources into an existing named module at runtime
`--patch-module <module>=<path>` merges additional classes or resources from the given path into the named module, commonly used for testing.
Question 39: Which keyword is used to create a subclass in Java?
- super
- inherits
- extends (Correct answer)
- instanceof
Correct answer: extends
In Java, the `extends` keyword is used to establish an inheritance relationship between classes. When a class `A` `extends` class `B`, `A` becomes a subclass (or child class) of `B`, inheriting its public and protected methods and fields. This promotes code reuse and establishes an 'is-a' relationship.
Question 40: What is the scope of a variable declared inside a `for` loop initializer?
- The for loop block and its update expression (Correct answer)
- The enclosing block only
- The entire method
- Only the loop condition
Correct answer: The for loop block and its update expression
A variable declared in the `for` initializer is scoped to the entire for statement including its condition, body, and update expressions.
Question 41: What is the purpose of the volatile keyword on a variable?
- It makes the variable immutable after first assignment
- It ensures atomic compound operations like i++
- It guarantees visibility of writes across threads without caching (Correct answer)
- It prevents the variable from being garbage collected
Correct answer: It guarantees visibility of writes across threads without caching
volatile ensures all threads see the most recent write by bypassing CPU caches, but does not make compound operations atomic.
Question 42: Which of the following is a valid declaration of a two-dimensional int array in Java?
- int[2][3] arr;
- int arr[][];
- int arr[2][3];
- int[][] arr; (Correct answer)
Correct answer: int[][] arr;
The canonical style places both bracket pairs after the type: `int[][] arr;`.
Question 43: What is the most important professional competency for 1Z0-819 certification in functional interfaces?
- Deep knowledge combined with practical application skills (Correct answer)
- Memorization of all reference materials
- Speed of task completion
- Ability to work alone exclusively
Correct answer: Deep knowledge combined with practical application skills
Professional competency requires both deep knowledge of the subject matter and the ability to apply that knowledge in practical situations.
Question 44: What is the effect of passing '--module-source-path' to javac?
- It adds an extra source path searched before the regular source path
- It instructs javac to generate automatic module-info.java stubs
- It enables multi-module compilation by specifying the root of multiple module source trees (Correct answer)
- It sets the output directory for compiled module-info.class files only
Correct answer: It enables multi-module compilation by specifying the root of multiple module source trees
'--module-source-path' enables javac to compile multiple modules simultaneously by specifying the directory that contains each module's source folder.
Question 45: What does the try-with-resources statement require of its resources?
- They must be declared final
- They must implement Serializable
- They must implement Closeable and be non-null
- They must implement AutoCloseable (Correct answer)
Correct answer: They must implement AutoCloseable
Resources in try-with-resources must implement AutoCloseable (or its subinterface Closeable), ensuring close() is called automatically.
Question 46: Which functional interface should you use when a lambda takes two arguments of the same type and returns a result of the same type?
- BinaryOperator<T> (Correct answer)
- UnaryOperator<T>
- BiConsumer<T,T>
- BiFunction<T,T,T>
Correct answer: BinaryOperator<T>
BinaryOperator<T> extends BiFunction<T,T,T> and is the correct specialization when both inputs and output share the same type.
Question 47: Which `Comparator` method reverses an existing comparator?
- reversed() (Correct answer)
- negate()
- naturalOrder()
- thenComparing()
Correct answer: reversed()
`Comparator.reversed()` returns a comparator that imposes the reverse ordering of the original.
Question 48: What happens when you call `consumer1.andThen(consumer2).accept(x)`?
- Both are called simultaneously
- consumer1 is called first, then consumer2 (Correct answer)
- consumer2 is called first, then consumer1
- Only consumer1 is called; consumer2 result is ignored
Correct answer: consumer1 is called first, then consumer2
Consumer.andThen() returns a composed Consumer that executes this consumer first, then the argument consumer.
Question 49: Which interface must a class implement to be used as the target of a Thread?
- Task
- Executable
- Callable
- Runnable (Correct answer)
Correct answer: Runnable
The Runnable functional interface (with its run() method) is the standard contract for thread task targets.
Question 50: What is the PRIMARY purpose of obtaining 1Z0-819 certification in Oracle Java SE 11 Developer?
- To demonstrate verified competency and adherence to professional standards (Correct answer)
- To bypass educational requirements
- To guarantee employment in the field
- To satisfy a personal achievement goal
Correct answer: To demonstrate verified competency and adherence to professional standards
Professional certification demonstrates that an individual has met established competency standards through verified assessment. It provides assurance to employers, clients, and the public that the certified professional possesses the knowledge and skills required for competent practice.
Question 51: Which `Connection` method creates a `Statement` object for executing static SQL?
- connection.makeStatement()
- connection.createStatement() (Correct answer)
- connection.buildStatement()
- connection.newStatement()
Correct answer: connection.createStatement()
`Connection.createStatement()` creates a `Statement` object used to execute static SQL queries without parameters.
Question 52: When using a lambda to implement an interface with a throws clause on the abstract method, what must the lambda body do?
- Wrap all exceptions in RuntimeException
- Declare its own throws clause with @throws
- Always throw the declared exception
- Handle or propagate only checked exceptions declared by the functional interface method (Correct answer)
Correct answer: Handle or propagate only checked exceptions declared by the functional interface method
The lambda body can throw checked exceptions only if the functional interface's abstract method declares them; otherwise only unchecked exceptions are permitted.
Question 53: Which statement about `CopyOnWriteArrayList` is TRUE?
- It throws ConcurrentModificationException during iteration
- Iterators reflect changes made after the iterator was created
- Writes create a fresh copy of the underlying array (Correct answer)
- It is synchronized and blocks writes during reads
Correct answer: Writes create a fresh copy of the underlying array
Every mutating operation on `CopyOnWriteArrayList` creates a new copy of the array, making iterators snapshot-safe but memory-intensive.
Question 54: What does flatMap() do differently from map()?
- flatMap() requires a BinaryOperator
- flatMap() flattens a stream of streams into a single stream (Correct answer)
- flatMap() applies the function in parallel
- map() handles null values; flatMap() does not
Correct answer: flatMap() flattens a stream of streams into a single stream
flatMap() applies a function that returns a Stream for each element and then flattens all resulting streams into one.
Question 55: Which of the following best describes the difference between `==` and `.equals()` for String objects?
- `==` compares references; `.equals()` compares content (Correct answer)
- Both compare references by default
- Both compare content by default
- `==` compares content; `.equals()` compares references
Correct answer: `==` compares references; `.equals()` compares content
`==` tests reference equality (same object in memory), while `String.equals()` tests value equality (same character sequence).
Question 56: What exception is thrown by JDBC methods when a database access error occurs?
- ConnectionException
- SQLException (Correct answer)
- IOException
- DBException
Correct answer: SQLException
`SQLException` is the checked exception thrown by virtually all JDBC API methods when a database or driver error occurs.
Question 57: What is the inferred type of the variable 'map' in: var map = new HashMap<String, List<Integer>>();?
- HashMap<String, ArrayList<Integer>>
- Map<String, List<Integer>>
- Object
- HashMap<String, List<Integer>> (Correct answer)
Correct answer: HashMap<String, List<Integer>>
var infers the exact static type of the right-hand side expression, which is HashMap<String, List<Integer>> — the concrete class, not the Map interface.
Question 58: Which of the following is an example of a widening primitive conversion?
- long to short
- float to byte
- double to int
- int to long (Correct answer)
Correct answer: int to long
Converting int to long is widening because long can represent all values an int can hold without data loss.
Question 59: What happens when you call `iterator.remove()` without first calling `iterator.next()`?
- Removes the last element
- Does nothing
- Throws IllegalStateException (Correct answer)
- Removes the first element
Correct answer: Throws IllegalStateException
The `Iterator` contract requires `next()` to be called before `remove()`; violating this throws `IllegalStateException`.
Question 60: Which method on `Path` combines the current path with another path segment?
- relativize()
- toAbsolutePath()
- resolve() (Correct answer)
- subpath()
Correct answer: resolve()
`resolve()` appends the given path to the base path, handling absolute/relative combinations correctly.
Question 61: What is a deadlock in concurrent programming?
- A condition where CPU scheduling starves a low-priority thread
- A thread that runs indefinitely without yielding
- A thread waiting for I/O that never completes
- Two or more threads each waiting for a lock held by the other (Correct answer)
Correct answer: Two or more threads each waiting for a lock held by the other
Deadlock is a circular wait condition where thread A holds lock X and wants Y, while thread B holds Y and wants X, causing both to block forever.
Question 62: When using `try-with-resources` with multiple `AutoCloseable` resources, in what order are they closed?
- Alphabetical order by variable name
- Order of declaration
- Reverse order of declaration (Correct answer)
- Simultaneously in parallel
Correct answer: Reverse order of declaration
Resources are closed in the reverse order they are declared, ensuring proper cleanup of dependent resources.
Question 63: Which quality management tool is MOST useful for 1Z0-819 professionals identifying the root cause of a problem?
- A suggestion box
- Employee satisfaction surveys
- Root cause analysis using tools such as fishbone diagrams or the 5 Whys method (Correct answer)
- Random audits without specific focus
Correct answer: Root cause analysis using tools such as fishbone diagrams or the 5 Whys method
Root cause analysis tools like fishbone diagrams and the 5 Whys method help professionals systematically trace problems back to their underlying causes rather than just addressing symptoms. This leads to more effective and lasting solutions.
Question 64: Which terminal operation must be used if you need the result to maintain encounter order in a parallel stream?
- findAny()
- forEach()
- forEachOrdered() (Correct answer)
- peek()
Correct answer: forEachOrdered()
forEachOrdered() respects the encounter order even in parallel streams, unlike forEach() which may process elements in any order.
Question 65: What is the primary consideration when implementing changes to modules system?
- Impact assessment and change management (Correct answer)
- Personal convenience
- Speed of implementation
- Vendor preference
Correct answer: Impact assessment and change management
Impact assessment and proper change management ensure that modifications do not introduce unexpected problems or service disruptions.
Question 66: What is a race condition?
- When a thread acquires locks in wrong order causing deadlock
- When program output depends on unpredictable relative timing of threads (Correct answer)
- When a thread loops faster than the JVM scheduler can handle
- When two threads run at exactly the same CPU clock speed
Correct answer: When program output depends on unpredictable relative timing of threads
A race condition occurs when correctness depends on the relative execution order of concurrent threads, which is non-deterministic.
Question 67: What is the difference between Stream.anyMatch() and Stream.allMatch() when the stream is empty?
- Both return true
- anyMatch returns true; allMatch returns false
- Both return false
- anyMatch returns false; allMatch returns true (Correct answer)
Correct answer: anyMatch returns false; allMatch returns true
On an empty stream, anyMatch() returns false (vacuously no element satisfies the predicate) and allMatch() returns true (vacuously all elements satisfy).
Question 68: Which meta-annotation specifies that an annotation should be recorded in the Javadoc output?
- @Retention
- @Inherited
- @Documented (Correct answer)
- @Target
Correct answer: @Documented
@Documented causes the annotation to appear in the generated Javadoc for the annotated element.
Question 69: A lambda that takes no arguments and returns void corresponds to which functional interface?
- Supplier<Void>
- Runnable (Correct answer)
- Function<Void,Void>
- Consumer<Void>
Correct answer: Runnable
Runnable's run() method takes no parameters and returns void, making it the natural fit for () -> { ... } style lambdas.
Question 70: What is the value of continuing education in functional interfaces for 1Z0-819 professionals?
- It keeps professionals current with evolving standards and practices (Correct answer)
- It replaces workplace experience
- It is only needed for recertification
- It is primarily a social activity
Correct answer: It keeps professionals current with evolving standards and practices
Continuing education ensures professionals stay current with the latest developments, standards, and best practices in their field.
Question 71: Which command inspects the module descriptor of a modular JAR file?
- jar --describe-module (Correct answer)
- jlink --list-modules
- jmod describe
- javap -m
Correct answer: jar --describe-module
'jar --describe-module' (or '-d') prints the module descriptor of a modular JAR file.
Question 72: A child interface inherits one abstract method from a parent interface and declares no new abstract methods. Can it be annotated with `@FunctionalInterface`?
- No — only top-level interfaces can be functional interfaces
- Yes — it still has exactly one abstract method (inherited), satisfying the SAM requirement (Correct answer)
- Yes — but only if the parent is also annotated with @FunctionalInterface
- No — inherited abstract methods are not counted
Correct answer: Yes — it still has exactly one abstract method (inherited), satisfying the SAM requirement
An interface can be functional if it has exactly one abstract method, whether inherited or declared; the parent need not be annotated.
Question 73: What is the function of the Stream API?
- To process collections with functional-style operations (Correct answer)
- To handle network connections.
- To create threads.
- To build user interfaces.
Correct answer: To process collections with functional-style operations
The Java Stream API, introduced in Java 8, provides a powerful and declarative way to process sequences of elements, such as collections or arrays. It enables functional-style operations like filtering, mapping, and reducing data, often in a parallelizable manner. Streams do not store data themselves but rather operate on data sources to produce a result.
Question 74: Which approach correctly loads a JDBC driver in Java 11 without explicitly calling `Class.forName()`?
- Java 11 removed JDBC driver support
- You must always call Class.forName() in Java 11
- The driver must be registered manually with DriverManager.registerDriver()
- The ServiceLoader mechanism automatically discovers drivers on the classpath via META-INF/services (Correct answer)
Correct answer: The ServiceLoader mechanism automatically discovers drivers on the classpath via META-INF/services
Since JDBC 4.0 (Java 6+), drivers on the classpath are auto-loaded via the `ServiceLoader` mechanism using `META-INF/services/java.sql.Driver`, eliminating the need for `Class.forName()`.
Question 75: In 1Z0-819 practice, what is the best approach to quality improvement in i/o operations?
- Make changes without measuring results
- Copy what other organizations do without analysis
- Use data-driven methods with measurable outcomes (Correct answer)
- Wait for problems to occur before acting
Correct answer: Use data-driven methods with measurable outcomes
Data-driven quality improvement with measurable outcomes ensures that changes actually produce the intended improvements and can be verified.
Question 76: Which method creates a Stream by reading lines from a file and is defined in java.nio.file.Files?
- Files.newBufferedReader().stream()
- Files.newStream()
- Files.readAllLines()
- Files.lines() (Correct answer)
Correct answer: Files.lines()
Files.lines(Path) returns a lazily-populated Stream<String> of lines from the file.
Question 77: In Oracle Java SE 11 Developer practice, what is the PRIMARY goal of a quality improvement program?
- To identify and discipline underperforming staff
- To meet minimum regulatory requirements only
- To reduce operational costs above all else
- To systematically enhance processes, outcomes, and stakeholder satisfaction (Correct answer)
Correct answer: To systematically enhance processes, outcomes, and stakeholder satisfaction
Quality improvement programs aim to systematically enhance processes, improve outcomes, and increase stakeholder satisfaction through continuous evaluation and evidence-based changes. The focus is on system improvement rather than individual blame.
Question 78: What functional interface does a constructor reference like `ArrayList::new` satisfy?
- Consumer<ArrayList>
- Supplier<ArrayList> (Correct answer)
- Function<ArrayList, ArrayList>
- UnaryOperator<ArrayList>
Correct answer: Supplier<ArrayList>
ArrayList::new with no arguments matches Supplier<ArrayList> because it takes no input and produces a new ArrayList instance.
Question 79: What is the result of calling size() on an ArrayList?
- Returns -1.
- Returns the number of stored elements (Correct answer)
- Returns the array length.
- Returns the memory usage.
Correct answer: Returns the number of stored elements
Calling the `size()` method on an `ArrayList` (or any `Collection` implementation) returns the current number of elements actually stored within that collection. This is distinct from the internal array's capacity or length, which might be larger than the number of elements. The `size()` method accurately reflects the logical count of items.
Question 80: In a multi-catch block 'catch (IOException | SQLException e)', what is the type of 'e'?
- Exception
- The common supertype of IOException and SQLException
- A union type that can only be rethrown (Correct answer)
- Object
Correct answer: A union type that can only be rethrown
In a multi-catch, the variable is implicitly final and typed as the union; it can only be rethrown as-is, not reassigned.
Java SE 11 Developer (1Z0-819) Exam
This exam certifies candidates on their understanding of Java SE 11 programming language concepts and their ability to apply them in real-world development scenarios.
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