Java SE 11 Developer (1Z0-819) Exam — Questions and Answers
Question 1: What role does continuous feedback play in 1Z0-819 quality improvement processes?
- It is primarily used for employee evaluations
- It provides ongoing data for identifying trends, successes, and areas needing improvement (Correct answer)
- It is unnecessary if initial standards are properly set
- It should only be collected from management
Correct answer: It provides ongoing data for identifying trends, successes, and areas needing improvement
Continuous feedback from multiple sources provides real-time data about performance, helps identify emerging trends, celebrates successes, and highlights areas that need improvement. This ongoing input is essential for a dynamic quality improvement process.
Question 2: A named module `com.util` exports `com.util.api` but not `com.util.internal`. A class in `com.util.internal` is needed by a test on the class path. Which option allows reflective access without modifying module-info.java?
- --add-exports com.util/com.util.internal=ALL-UNNAMED
- --open com.util/com.util.internal
- --add-reads com.util=ALL-UNNAMED
- --add-opens com.util/com.util.internal=ALL-UNNAMED (Correct answer)
Correct answer: --add-opens com.util/com.util.internal=ALL-UNNAMED
`--add-opens` grants deep reflective access (private members included) to a package; `ALL-UNNAMED` targets code on the class path (the unnamed module).
Question 3: What role does peer review play in the 1Z0-819 design process?
- It provides independent verification, catches errors, and enhances overall quality (Correct answer)
- It is only required for regulatory submissions
- It is unnecessary for experienced professionals
- It slows down the design process unnecessarily
Correct answer: It provides independent verification, catches errors, and enhances overall quality
Peer review is a valuable quality control mechanism that provides independent verification of design work, catches errors that the original designer might overlook, and enhances overall quality through diverse perspectives and expertise.
Question 4: What is the result of using 'final' with a variable in Java?
- The variable can be changed later.
- The variable is assigned only once (Correct answer)
- The variable becomes static.
- The variable is deleted.
Correct answer: The variable is assigned only once
When the `final` keyword is used with a variable in Java, it means that the variable's value can only be assigned once. After its initial assignment, the value of a `final` variable cannot be changed, making it a constant. This applies to both primitive types (value itself is constant) and reference types (the reference itself is constant, not the object it points to).
Question 5: Which `jdeps` flag generates a `module-info.java` template for a non-modular JAR?
- --module-info
- --multi-release
- --suggest-providers
- --generate-module-info (Correct answer)
Correct answer: --generate-module-info
`jdeps --generate-module-info <dir> <jar>` analyzes dependencies and writes a draft `module-info.java` to the specified directory.
Question 6: Which JDK tool creates a custom runtime image from a set of modules?
- jmod
- jimage
- jlink (Correct answer)
- jdeps
Correct answer: jlink
'jlink' assembles and optimizes a custom runtime image containing only the specified modules and their transitive dependencies.
Question 7: What exception is thrown when you attempt to add a null element to a `TreeSet`?
- IllegalArgumentException
- NullPointerException (Correct answer)
- ClassCastException
- UnsupportedOperationException
Correct answer: NullPointerException
`TreeSet` uses natural ordering or a `Comparator`, and comparing `null` causes a `NullPointerException` when the first comparison is attempted.
Question 8: Which collector can be used to produce a Map<Boolean, List<T>> from a stream?
- Collectors.groupingBy()
- Collectors.partitioningBy() (Correct answer)
- Collectors.collectingAndThen()
- Collectors.toMap()
Correct answer: Collectors.partitioningBy()
partitioningBy(Predicate) always produces a two-entry Map<Boolean, List<T>> keyed on true and false.
Question 9: What role does calibration play in maintaining technical accuracy for Oracle Java SE 11 Developer professionals?
- It ensures instruments and methods produce accurate, consistent results over time (Correct answer)
- It only matters during formal inspections
- It is an optional best practice for advanced professionals
- It is only necessary for new equipment
Correct answer: It ensures instruments and methods produce accurate, consistent results over time
Regular calibration ensures that instruments, tools, and methods continue to produce accurate and consistent results over time. Without calibration, measurement drift and equipment wear can lead to unreliable outcomes.
Question 10: Which method of java.lang.reflect.AnnotatedElement returns all annotations directly present on an element, excluding inherited ones?
- getDeclaredAnnotations() (Correct answer)
- getAnnotations()
- findAnnotation()
- getAnnotationsByType()
Correct answer: getDeclaredAnnotations()
getDeclaredAnnotations() returns only annotations directly present on the element, ignoring @Inherited annotations from superclasses.
Question 11: Which method creates a Stream by reading lines from a file and is defined in java.nio.file.Files?
- Files.newBufferedReader().stream()
- Files.lines() (Correct answer)
- Files.newStream()
- Files.readAllLines()
Correct answer: Files.lines()
Files.lines(Path) returns a lazily-populated Stream<String> of lines from the file.
Question 12: Which `Comparator` method reverses an existing comparator?
- thenComparing()
- negate()
- reversed() (Correct answer)
- naturalOrder()
Correct answer: reversed()
`Comparator.reversed()` returns a comparator that imposes the reverse ordering of the original.
Question 13: What distinguishes a Oracle Java SE 11 Developer certified professional from a non-certified practitioner?
- There is no meaningful difference in competency
- Certification validates competency through standardized assessment against established benchmarks (Correct answer)
- Certified professionals always have more years of experience
- Certified professionals exclusively work in larger organizations
Correct answer: Certification validates competency through standardized assessment against established benchmarks
Certification provides objective validation of competency through standardized assessment. While non-certified practitioners may be skilled, certification offers verified evidence that a professional meets established benchmarks for knowledge and performance.
Question 14: Which method converts an `IntStream` to a `Stream<Integer>` (boxed)?
- mapToObj(Integer::valueOf)
- asStream()
- boxed() (Correct answer)
- toStream()
Correct answer: boxed()
`IntStream.boxed()` is the idiomatic way to convert a primitive `IntStream` to a `Stream<Integer>`.
Question 15: What is the output of: `System.out.println(10 / 3);`?
- Compilation error
- 3.333
- 3.0
- 3 (Correct answer)
Correct answer: 3
Integer division truncates the decimal part, so 10 / 3 yields 3.
Question 16: What is the most important professional competency for 1Z0-819 certification in jdbc?
- Ability to work alone exclusively
- Memorization of all reference materials
- Speed of task completion
- Deep knowledge combined with practical application skills (Correct answer)
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 17: What does `Connection.setAutoCommit(false)` do in JDBC?
- Closes the connection after each statement
- Disables connection pooling
- Begins a manual transaction requiring explicit commit or rollback (Correct answer)
- Rolls back all pending changes immediately
Correct answer: Begins a manual transaction requiring explicit commit or rollback
Setting autoCommit to false puts the connection into manual transaction mode where you must call `commit()` or `rollback()` explicitly.
Question 18: Which keyword is used to create a subclass in Java?
- instanceof
- inherits
- super
- extends (Correct answer)
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 19: Which method is used to add an element to a List?
- push()
- append()
- add() (Correct answer)
- insert()
Correct answer: add()
The standard method used to add an element to a `List` in Java is `add()`. This method appends the specified element to the end of the list. There are also overloaded versions of `add()` that allow inserting an element at a specific index.
Question 20: When a design constraint conflicts with a stakeholder preference in Oracle Java SE 11 Developer, the BEST approach is to:
- Always prioritize the stakeholder's preference
- Ignore the constraint if the stakeholder insists
- Remove all constraints to maximize design flexibility
- Evaluate both factors, communicate trade-offs, and find an optimal solution (Correct answer)
Correct answer: Evaluate both factors, communicate trade-offs, and find an optimal solution
When constraints and preferences conflict, professionals should evaluate both factors objectively, clearly communicate the trade-offs to stakeholders, and work collaboratively to find a solution that best balances both considerations.
Question 21: What is the behavior of a FixedThreadPool created with Executors.newFixedThreadPool(3) when a 4th task is submitted while all 3 threads are busy?
- The task is queued in an unbounded LinkedBlockingQueue (Correct answer)
- The calling thread executes the task inline
- It creates a temporary 4th thread to handle the task
- It throws RejectedExecutionException
Correct answer: The task is queued in an unbounded LinkedBlockingQueue
newFixedThreadPool uses an unbounded LinkedBlockingQueue, so excess tasks wait in the queue rather than being rejected or creating new threads.
Question 22: Which method reference form is used in `Arrays.sort(names, String::compareToIgnoreCase)`?
- Instance method reference on a particular instance
- Static method reference
- Constructor reference
- Instance method reference on an arbitrary instance of a type (Correct answer)
Correct answer: Instance method reference on an arbitrary instance of a type
String::compareToIgnoreCase is an instance method reference on an arbitrary instance — the first argument becomes the receiver of the method call.
Question 23: An annotation element type must be one of the permitted types. Which of the following is NOT a permitted annotation element type?
- An enum constant type
- A primitive type
- A String
- A generic type parameter (e.g., T) (Correct answer)
Correct answer: A generic type parameter (e.g., T)
Annotation element types must be primitives, String, Class, enum, another annotation type, or arrays thereof — generic type parameters are not permitted.
Question 24: Given `Function<String, Integer> f = Integer::parseInt;`, what kind of method reference is this?
- Instance method reference on a particular instance
- Constructor reference
- Instance method reference on an arbitrary instance
- Static method reference (Correct answer)
Correct answer: Static method reference
Integer.parseInt is a static method, so Integer::parseInt is a static method reference.
Question 25: Which of the following is a valid `@FunctionalInterface`?
- An interface with one abstract method that overrides `Object.toString()`
- An interface with one abstract method that does not override any Object method (Correct answer)
- An interface with two abstract methods and one default method
- An abstract class with exactly one abstract method
Correct answer: An interface with one abstract method that does not override any Object method
A functional interface must be an interface with exactly one abstract method that is not a re-declaration of an Object method.
Question 26: Given `String s = null; System.out.println(s instanceof String);`, what is printed?
- Compilation error
- true
- NullPointerException
- false (Correct answer)
Correct answer: false
`instanceof` always returns false when the left operand is null, without throwing an exception.
Question 27: In 1Z0-819 practice, what is the best approach to quality improvement in jdbc?
- Copy what other organizations do without analysis
- Use data-driven methods with measurable outcomes (Correct answer)
- Wait for problems to occur before acting
- Make changes without measuring results
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 28: What is the MOST important deliverable at the completion of a 1Z0-819 design phase?
- A brief email summarizing key decisions
- Meeting minutes from design discussions
- A verbal summary of the design concept
- Comprehensive documentation including specifications, drawings, calculations, and compliance evidence (Correct answer)
Correct answer: Comprehensive documentation including specifications, drawings, calculations, and compliance evidence
Comprehensive design documentation serves as the authoritative reference for implementation, provides evidence of compliance, supports future maintenance and modifications, and creates a professional record of the design process.
Question 29: What command lists all observable modules in the current JDK installation?
- jmod list
- java --describe-module java.se
- jlink --list-modules
- java --list-modules (Correct answer)
Correct answer: java --list-modules
'java --list-modules' outputs all platform and observable modules available to the current JDK.
Question 30: What does `Stream.of("a","b","c").skip(1).limit(1).findFirst()` return?
- Optional.empty()
- Optional[a]
- Optional[b] (Correct answer)
- Optional[c]
Correct answer: Optional[b]
`skip(1)` discards "a", leaving "b" and "c"; `limit(1)` keeps only "b"; `findFirst()` returns `Optional[b]`.
Question 31: Which command-line option adds a module to the set of root modules resolved by the module system?
- --patch-module
- --module-path
- --add-modules (Correct answer)
- --add-opens
Correct answer: --add-modules
'--add-modules' explicitly adds one or more modules to the root module set during resolution.
Question 32: What is the difference between `Function.andThen(g)` and `Function.compose(g)`?
- compose only works with UnaryOperator
- andThen applies g after this function; compose applies g before (Correct answer)
- andThen applies g before this function; compose applies g after
- They are identical in behavior
Correct answer: andThen applies g after this function; compose applies g before
andThen(g) means this → g; compose(g) means g → this, reversing the application order.
Question 33: Which interface does `UnaryOperator<T>` extend?
- Supplier<T>
- Consumer<T>
- Function<T,T> (Correct answer)
- Predicate<T>
Correct answer: Function<T,T>
UnaryOperator<T> extends Function<T,T>, specialising it for the case where input and output types are the same.
Question 34: What is the correct signature for Collections.sort() that handles types comparable to their supertypes?
- public static <T extends Comparable<? super T>> void sort(List<T> list) (Correct answer)
- public static <T super Comparable<T>> void sort(List<T> list)
- public static <T implements Comparable<T>> void sort(List<T> list)
- public static <T extends Comparable<T>> void sort(List<T> list)
Correct answer: public static <T extends Comparable<? super T>> void sort(List<T> list)
Collections.sort() uses <T extends Comparable<? super T>> to allow types whose compareTo method accepts a supertype, making it more flexible than the simpler <T extends Comparable<T>>.
Question 35: Which metric is MOST valuable for measuring quality outcomes in 1Z0-819 certified practice?
- Measurable outcomes compared against established benchmarks and standards (Correct answer)
- Cost savings achieved through shortcuts
- Volume of work completed regardless of results
- Number of hours worked per week
Correct answer: Measurable outcomes compared against established benchmarks and standards
Measuring outcomes against established benchmarks and standards provides objective evidence of quality. This approach allows for comparison across time periods, identification of trends, and meaningful evaluation of improvement efforts.
Question 36: What is the purpose of exception handling in Java?
- To stop program execution immediately.
- To reduce performance.
- To handle errors gracefully during runtime (Correct answer)
- To increase code complexity.
Correct answer: To handle errors gracefully during runtime
Exception handling in Java provides a structured way to deal with runtime errors, known as exceptions, that disrupt the normal flow of program execution. Its primary purpose is to prevent programs from crashing abruptly and instead allow them to recover gracefully or terminate in a controlled manner, improving robustness. It does not aim to stop execution immediately, increase complexity, or reduce performance, but rather to manage unexpected situations effectively.
Question 37: What is a checked exception in Java?
- Runtime exceptions only.
- Errors that cause system crashes.
- Exceptions that must be declared or handled (Correct answer)
- Exceptions ignored by the compiler.
Correct answer: Exceptions that must be declared or handled
A checked exception in Java is an exception that the compiler enforces you to handle. This means that methods throwing checked exceptions must either declare them using the `throws` keyword in their signature or enclose the problematic code within a `try-catch` block. This design ensures that developers explicitly consider and address potential error conditions, making programs more robust.
Question 38: Which of the following is an example of a widening primitive conversion?
- double to int
- long to short
- float to byte
- 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 39: What is the purpose of `FileChannel.transferTo(position, count, target)`?
- Creates a new file channel from an existing one
- Reads a file into a byte array
- Efficiently transfers bytes from one channel to another, potentially using OS-level zero-copy (Correct answer)
- Writes a ByteBuffer to a file
Correct answer: Efficiently transfers bytes from one channel to another, potentially using OS-level zero-copy
`transferTo` can leverage OS zero-copy mechanisms to move data between channels without buffering in the JVM heap.
Question 40: In Oracle Java SE 11 Developer practice, what is the CORRECT sequence when performing a technical procedure?
- Plan, prepare, execute, verify, and document (Correct answer)
- Execute immediately and document only if issues arise
- Execute, then plan and review
- Document, execute, then plan
Correct answer: Plan, prepare, execute, verify, and document
The correct sequence follows a systematic approach: plan the procedure, prepare necessary resources, execute according to standards, verify results meet specifications, and document the process and outcomes. This ensures quality and accountability.
Question 41: Which class provides buffered character-based reading with a `readLine()` method?
- FileReader
- BufferedReader (Correct answer)
- Scanner
- InputStreamReader
Correct answer: BufferedReader
`BufferedReader` wraps a `Reader` and offers the `readLine()` convenience method.
Question 42: Which block must always follow a try block?
- switch
- do
- loop
- finally (Correct answer)
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 43: Which method on `Statement` adds a SQL command to a pending batch without executing it immediately?
- queueBatch(sql)
- addBatch(sql) (Correct answer)
- stageBatch(sql)
- appendBatch(sql)
Correct answer: addBatch(sql)
`Statement.addBatch(sql)` appends the SQL command to the current batch list; the batch is not sent to the database until `executeBatch()` is called.
Question 44: Which factor MOST significantly affects the quality of technical outcomes in 1Z0-819 practice?
- The speed at which procedures are completed
- The brand of equipment being used
- The practitioner's training, preparation, and attention to detail (Correct answer)
- The time of day the procedure is performed
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 45: What is the purpose of the ExecutorService in Java?
- To increase CPU usage.
- To log system calls.
- To monitor memory usage.
- To manage and control multiple threads (Correct answer)
Correct answer: To manage and control multiple threads
The `ExecutorService` in Java's `java.util.concurrent` package provides a high-level API for managing and controlling the execution of tasks in a pool of threads. It abstracts away the complexities of thread creation, lifecycle management, and task scheduling, making it easier to implement concurrent applications. This allows developers to focus on the tasks themselves rather than the underlying thread management.
Question 46: What does Stream.empty() return when collect(Collectors.toList()) is called?
- An empty Optional
- An empty List (Correct answer)
- A List with one null element
- null
Correct answer: An empty List
Stream.empty() has no elements, so collecting to a list produces an empty (non-null) List.
Question 47: When using `PreparedStatement`, which method binds a Java `int` value to the first placeholder?
- setInteger(1, value)
- setInt(1, value) (Correct answer)
- bindInt(1, value)
- setInt(0, 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 48: Which approach best demonstrates mastery of i/o operations in 1Z0-819 practice?
- Following procedures without understanding
- Avoiding complex scenarios
- Applying principles to novel situations with sound judgment (Correct answer)
- Relying entirely on technology
Correct answer: Applying principles to novel situations with sound judgment
True mastery involves understanding underlying principles well enough to apply them to new and unfamiliar situations with professional judgment.
Question 49: Which functional interface should you prefer for `x -> x * 2` when `x` is a primitive `int`, to avoid autoboxing?
- UnaryOperator<Integer>
- IntFunction<Integer>
- Function<Integer,Integer>
- IntUnaryOperator (Correct answer)
Correct answer: IntUnaryOperator
IntUnaryOperator works entirely with primitive int values via applyAsInt(), eliminating all boxing overhead.
Question 50: What is the effect of passing '--module-source-path' to javac?
- It instructs javac to generate automatic module-info.java stubs
- It sets the output directory for compiled module-info.class files only
- It adds an extra source path searched before the regular source path
- It enables multi-module compilation by specifying the root of multiple module source trees (Correct answer)
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 51: What is the default sorting method in Java?
- Lexicographical order.
- Random sort.
- Reverse alphabetical.
- Natural order using Comparable (Correct answer)
Correct answer: Natural order using Comparable
When sorting objects in Java using methods like `Collections.sort()` or `Arrays.sort()` without a custom `Comparator`, the default sorting mechanism is based on the 'natural order' of the elements. This natural order is defined by the `compareTo()` method of the `Comparable` interface, which the objects must implement. For primitive types and `String`s, natural order is built-in.
Question 52: What is printed by: `var sb = new StringBuilder("abc"); sb.reverse(); System.out.println(sb);`?
- cba (Correct answer)
- bac
- abc
- Compilation error
Correct answer: cba
`StringBuilder.reverse()` reverses the character sequence in-place and returns the same `StringBuilder`, so printing it shows "cba".
Question 53: Which @Deprecated attribute, added in Java 9 alongside the module system, marks an API slated for removal?
- obsolete=true
- status=REMOVAL
- since="9", removal=true
- forRemoval=true (Correct answer)
Correct answer: forRemoval=true
The 'forRemoval=true' attribute on @Deprecated was added in Java 9 to signal that an API is scheduled for removal in a future release.
Question 54: Which method returns an `OptionalInt` containing the sum of an `IntStream`?
- reduce(Integer::sum) (Correct answer)
- sum()
- collect()
- average()
Correct answer: reduce(Integer::sum)
`IntStream.reduce(Integer::sum)` returns an `OptionalInt` because the stream might be empty; `sum()` returns a plain `int`.
Question 55: Which of the following is NOT a valid lambda expression in Java 11?
- (int x, y) -> x + y (Correct answer)
- () -> {}
- x -> x + 1
- (int x, int y) -> x + y
Correct answer: (int x, y) -> x + y
When parameter types are explicitly listed you must provide types for all parameters; mixing typed and untyped parameters is a compile error.
Question 56: What does the 'synchronized' keyword ensure?
- Mutual exclusion of threads in critical sections (Correct answer)
- Thread termination.
- Better exception handling.
- All threads run faster.
Correct answer: Mutual exclusion of threads in critical sections
The `synchronized` keyword in Java is used to achieve mutual exclusion, ensuring that only one thread can execute a specific block of code or method at a time. This is critical for protecting shared resources from concurrent access by multiple threads, thereby preventing data corruption and race conditions. It helps maintain data consistency in multi-threaded environments.
Question 57: What is the purpose of a no-argument (no-arg) constructor?
- It automatically initializes all fields to their maximum values
- It prevents subclasses from adding constructors
- It enables object creation without providing initial field values (Correct answer)
- It is required for all Java classes
Correct answer: It enables object creation without providing initial field values
A no-arg constructor allows a class to be instantiated without any arguments, which is also required by many frameworks for reflection-based object creation.
Question 58: Which functional interface represents a supplier that may throw a checked exception when used in a custom functional interface?
- Supplier<T>
- Function<T,T>
- Consumer<T>
- Callable<T> (Correct answer)
Correct answer: Callable<T>
Callable<T> declares throws Exception on its call() method, while Supplier's get() does not declare a checked exception.
Question 59: What role does calibration play in maintaining technical accuracy for Oracle Java SE 11 Developer professionals?
- It only matters during formal inspections
- It is an optional best practice for advanced professionals
- It ensures instruments and methods produce accurate, consistent results over time (Correct answer)
- It is only necessary for new equipment
Correct answer: It ensures instruments and methods produce accurate, consistent results over time
Regular calibration ensures that instruments, tools, and methods continue to produce accurate and consistent results over time. Without calibration, measurement drift and equipment wear can lead to unreliable outcomes.
Question 60: What is the result of `Duration.between(LocalTime.of(10,0), LocalTime.of(9,0)).toHours()`?
- -1 (Correct answer)
- 23
- 1
- Throws DateTimeException
Correct answer: -1
`Duration.between` subtracts the start from the end; since end (9:00) is before start (10:00), the result is a negative duration of -1 hour.
Question 61: Which of the following correctly declares a type parameter with multiple bounds?
- public class MyClass<T implements Serializable & Comparable<T>>
- public class MyClass<T extends Serializable & Comparable<T>> (Correct answer)
- public class MyClass<T extends Serializable, Comparable<T>>
- public class MyClass<T super Serializable & Comparable<T>>
Correct answer: public class MyClass<T extends Serializable & Comparable<T>>
Multiple bounds use the & separator between bounds, and all bounds must use the extends keyword — even for interfaces — as in <T extends Serializable & Comparable<T>>.
Question 62: What does Collectors.summarizingInt(ToIntFunction) produce?
- An Integer sum
- An OptionalInt
- A Map of statistics
- An IntSummaryStatistics object (Correct answer)
Correct answer: An IntSummaryStatistics object
summarizingInt() collects count, sum, min, max, and average into an IntSummaryStatistics instance.
Question 63: Which method of `PreparedStatement` is used to execute a SQL INSERT and return the number of affected rows?
- executeUpdate() (Correct answer)
- executeBatch()
- executeQuery()
- execute()
Correct answer: executeUpdate()
`executeUpdate()` executes DML statements (INSERT, UPDATE, DELETE) and returns the count of affected rows.
Question 64: What is the difference between `IntFunction<R>` and `ToIntFunction<T>`?
- They are identical
- IntFunction takes an int and returns R; ToIntFunction takes T and returns an int (Correct answer)
- IntFunction takes T and returns an int; ToIntFunction takes an int and returns R
- IntFunction only works with Integer objects
Correct answer: IntFunction takes an int and returns R; ToIntFunction takes T and returns an int
IntFunction<R> accepts a primitive int and produces a result R; ToIntFunction<T> accepts any T and produces a primitive int.
Question 65: Which tool is used to link a set of modules into a custom runtime image in Java 11?
- jmod
- jshell
- jdeps
- jlink (Correct answer)
Correct answer: jlink
`jlink` assembles and optimizes a set of modules and their transitive dependencies into a custom, self-contained runtime image.
Question 66: Which `Files` method reads all lines of a text file into a `List<String>` using the default charset?
- Files.lines(path)
- Files.readAllLines(path) (Correct answer)
- Files.readAllBytes(path)
- Files.readString(path)
Correct answer: Files.readAllLines(path)
`Files.readAllLines(path)` reads all lines into a `List<String>` using UTF-8 by default in Java 11.
Question 67: What does `Arrays.asList(1, 2, 3).remove(0)` do at runtime?
- Throws UnsupportedOperationException (Correct answer)
- Returns false
- Removes element 1
- Removes element 0
Correct answer: Throws UnsupportedOperationException
The list returned by `Arrays.asList` is fixed-size; structural modifications like `remove` throw `UnsupportedOperationException`.
Question 68: What exception is thrown when you call `Files.readAllBytes` on a path that does not exist?
- IllegalArgumentException
- FileNotFoundException
- NoSuchFileException (Correct answer)
- IOException
Correct answer: NoSuchFileException
`Files.readAllBytes` throws `NoSuchFileException` (a subclass of `IOException`) when the file is absent.
Question 69: A child interface inherits one abstract method from a parent interface and declares no new abstract methods. Can it be annotated with `@FunctionalInterface`?
- Yes — it still has exactly one abstract method (inherited), satisfying the SAM requirement (Correct answer)
- No — only top-level interfaces can be functional interfaces
- 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 70: A lambda body attempts to modify a local variable declared in the enclosing method. What happens?
- The variable is silently copied into the lambda
- The modification is allowed only if the variable is declared volatile
- A compilation error occurs because local variables captured by lambdas must be effectively final (Correct answer)
- The JVM creates a new stack frame for the modification
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 71: Which of the following is not a Java access modifier?
- friendly
- private
- protected
- public
Java has four primary access modifiers: `public`, `protected`, `private`, and the default (package-private, which has no keyword). The term 'friendly' is sometimes informally used to describe the default access level, but it is not a reserved keyword or a formal access modifier in Java. Therefore, `friendly` is not a Java access modifier.
Question 72: What happens if you call `Connection.rollback()` when `autoCommit` is `true`?
- It has no effect
- It throws an SQLException (Correct answer)
- It rolls back all changes since the last commit
- It disables autoCommit automatically
Correct answer: It throws an SQLException
Calling `rollback()` when `autoCommit` is `true` throws an `SQLException` because there is no active transaction to roll back.
Question 73: Which interface should you use when you need to call a stored procedure in JDBC?
- Statement
- CallableStatement (Correct answer)
- PreparedStatement
- StoredStatement
Correct answer: CallableStatement
`CallableStatement` extends `PreparedStatement` and is specifically designed to execute stored procedures via the `{call procedure_name(?)}` syntax.
Question 74: How should Oracle Java SE 11 Developer professionals handle technical procedures that have been updated or revised?
- Wait for mandatory enforcement before changing
- Only apply updates to new cases or projects
- Review the updates, complete any required training, and implement the revised procedures (Correct answer)
- Continue using the original method if it still works
Correct answer: Review the updates, complete any required training, and implement the revised procedures
When procedures are updated, professionals must review the changes, complete any required training to understand the rationale and new requirements, and implement the revised procedures in their practice. Continuing outdated methods risks non-compliance and suboptimal outcomes.
Question 75: Which interface must be implemented to sort objects in Java?
- Comparable (Correct answer)
- Cloneable
- Serializable
- Runnable
Correct answer: Comparable
To sort objects in Java based on their 'natural order,' the class of these objects must implement the `Comparable` interface. This interface requires the implementation of the `compareTo()` method, which defines how instances of the class should be ordered relative to each other. For custom sorting criteria, the `Comparator` interface is used.
Question 76: What is the default value of an instance variable of type `boolean` in Java?
- false (Correct answer)
- true
- 0
- null
Correct answer: false
Instance variables of type boolean are initialized to false by default when a class is instantiated.
Question 77: How does the Java module system handle split packages (the same package name in two named modules)?
- It throws an error at module resolution time — split packages are not allowed between named modules (Correct answer)
- It logs a warning but continues execution
- It merges the packages at runtime automatically
- It uses the first module found on the module path
Correct answer: It throws an error at module resolution time — split packages are not allowed between named modules
Split packages between two named modules are illegal; the module system rejects them during resolution with a `LayerInstantiationException` or startup error.
Question 78: What does `String.format("%05d", 42)` produce?
- 00042 (Correct answer)
- 42000
- 042
- 42
Correct answer: 00042
The `%05d` format specifier pads the integer with leading zeros to a width of 5.
Question 79: Which `javac` option specifies the root directories containing module source code when compiling multiple modules at once?
- --module-path
- --module-source-path (Correct answer)
- --source-path
- --root-path
Correct answer: --module-source-path
`--module-source-path` tells `javac` where to find the source tree organized by module directories when performing multi-module compilation.
Question 80: Which professional attribute is most valued in functional interfaces within the 1Z0-819 field?
- Working in isolation
- Prioritizing personal convenience
- Avoiding challenging situations
- Accountability and commitment to standards (Correct answer)
Correct answer: Accountability and commitment to standards
Accountability and commitment to professional standards build trust and ensure consistent, high-quality practice.
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