Limited-Time Offer: Enjoy 50% Savings! - Ends In 0d 00h 00m 00s Coupon code: 50OFF
Welcome to QA4Exam

Free practice questions with explanations

Oracle 1Z0-829 Dumps 2026 with Free Practice Questions and Answers

17 original Java SE 17 Developer exam practice questions with answers and explanations.

Covers Accessing Databases Using JDBC, Controlling Program Flow, Handling Date, Time, Text, Numeric And Boolean Values, Managing Concurrent Code Execution and 7 more.

Question types: single answer, multiple answers, order list, drag and drop and dropdown. A new question is added every 15 days.

1Z0-829 Practice Set Details

Vendor
Oracle
Exam Code
1Z0-829
Questions On This Page
17
Exam Topics Covered
11 of 11
Question Types
5
Newest Question
New Question
Every 15 days
Full Question Set
50
Certification
Oracle Java
17 questions

Oracle 1Z0-829 Exam Questions and Answers by Topic

Handling Date, Time, Text, Numeric and Boolean Values

2 practice questions on this topicWhat this topic covers

Question 1

Added

Single Answer

A booking service stores a departure as an Instant and must show the local departure date and time for the destination's IANA time zone. Customers can book across daylight-saving transitions, so adding a fixed number of hours to UTC is not acceptable. Which approach correctly derives the displayed value?

Correct answer: B

`LocalDateTime.ofInstant` applies the rules in the supplied `ZoneId` at that instant, including the correct historical or daylight-saving offset. A current fixed offset can be wrong for the departure date and does not represent the zone's rule set. Converting to UTC and then adding an offset as a duration does not correctly model zone transitions. Epoch seconds are not local date-time fields; use the Instant-to-zone conversion API.

Question 2

Added

Single Answer

A subscription system charges a customer for each complete calendar month between two dates, ignoring partial months. Both dates are LocalDate values, and the end date is guaranteed not to precede the start date. The calculation must follow calendar-month boundaries rather than assume every month has a fixed number of days. Which approach is correct?

Correct answer: B

`Period.between` computes a calendar-based period between LocalDate values, and `toTotalMonths()` returns its complete months, ignoring any remaining days. A Duration measures elapsed time and dividing its days by 30 assumes fixed-length months. Subtracting day-of-month values ignores year and month differences. Epoch-millisecond arithmetic likewise measures elapsed time and imposes a fixed month length.

Controlling Program Flow

2 practice questions on this topicWhat this topic covers

Question 3

Added

Single Answer

A routing component receives an integer command code. Codes 1 and 2 must both return "standard"; code 3 must return "priority"; every other value must return "unknown". The team wants a switch expression, and the code must compile without relying on statement fall-through. Which implementation meets the requirements?

Correct answer: D

The arrow-form switch expression groups labels 1 and 2, returns a value for every case, and cannot fall through. A switch expression using colon labels needs `yield` in each value-producing block; the statements shown do not form a valid expression. Colon labels followed by bare string literals are not valid switch statement bodies. The final alternative omits a default, so it is not exhaustive for an `int` switch expression.

Question 4

Added

Single Answer

A batch processor scans an array of nonnegative measurements. It must add values until it encounters the first value greater than 100, exclude that value and all later values, and then return the accumulated total. Which loop structure implements this behavior?

Correct answer: C

A `break` exits the loop at the first value over 100, so neither that value nor any later value is added. `continue` skips only the current iteration and would allow later measurements to be included. Adding before the do-while condition includes the disallowed value before it can terminate the loop. Resetting the accumulator does not terminate processing and discards valid earlier totals.

Utilizing Java Object-Oriented Approach

1 practice question on this topicWhat this topic covers

Question 5

Added

Drag And Drop

A library is being refactored so client code can depend on abstractions while preserving the specified class relationships and initialization behavior. Match each design requirement to the Java construct that satisfies it.

Drag each item onto its matching target. On a phone: tap an item, then tap a target.

Allow an implementing class to inherit behavior while permitting override
Run class-level initialization once when the class is initialized
Provide a data carrier with generated accessors and value-based equals
Permit only two named subclasses in the same module
Default interface method
Static initializer
Record
Sealed class with a permits clause
Correct answer:
  • Permit only two named subclasses in the same module → Sealed class with a permits clause
  • Provide a data carrier with generated accessors and value-based equals → Record
  • Allow an implementing class to inherit behavior while permitting override → Default interface method
  • Run class-level initialization once when the class is initialized → Static initializer

A sealed class with a permits clause restricts direct subclasses to the named types, subject to Java's permitted-subclass rules. Records provide component accessors and generated value-oriented methods such as equals and hashCode. A default interface method supplies an implementation that implementing classes may override. A static initializer runs as part of class initialization, rather than once per instance.

Handling Exceptions

1 practice question on this topicWhat this topic covers

Question 6

Added

Single Answer

A file importer opens a BufferedReader and may throw IOException while reading. If parsing fails, the importer must report the parsing failure while still closing the reader; if closing also fails, the original parsing failure must remain the primary exception. Which implementation provides this behavior?

Correct answer: B

Try-with-resources closes the reader on both normal and exceptional exits. If the body throws and close also throws, Java preserves the body exception as primary and records the close exception as suppressed. Closing only in finally can allow a close failure to mask the parsing failure. A multi-catch does not close resources automatically, and returning normally would discard the failure. Closing only after parsing fails leaks the reader on successful processing.

Working with Arrays and Collections

1 practice question on this topicWhat this topic covers

Question 7

Added

Multiple Answers

A service maintains a sorted, duplicate-free set of case-sensitive String identifiers and must frequently retrieve the lexicographically first identifier. It must preserve normal String ordering and reject null identifiers. The collection is read and updated by one thread, so concurrent collection behavior is not needed. Which two choices meet the requirements? (Choose two.)

Correct answer: B, D

A TreeSet using natural String ordering maintains sorted order and uniqueness, while validating inputs rejects null before insertion. Its `first()` method retrieves the least element according to that ordering. A HashSet is unordered and cannot be sorted in place with `Collections.sort`. A PriorityQueue does not provide Set uniqueness and scanning adds unnecessary work. A length comparator changes the required lexicographic order and can treat distinct same-length strings as equal if it returns zero.

Working with Streams and Lambda Expressions

2 practice questions on this topicWhat this topic covers

Question 8

Added

Dropdown

A sales report groups orders by region, then computes the sum of each order's amount. The amount is a long, and the result must be a Map from region to Long using the standard collector APIs. Complete the collector expression.

Choose the correct value for each blank.

Map totals = orders.stream().collect(Collectors.groupingBy(Order::region, Collectors.(Order::amount, )));
Correct answer:

Map totals = orders.stream().collect(Collectors.groupingBy(Order::region, Collectors.summingLong(Order::amount, Long::sum)));

`groupingBy` accepts a downstream collector, and `summingLong` maps each Order to a long-valued amount and sums those values for each region. The second argument to `summingLong` is a function that extracts a long; `Order::amount` supplies it, so the collector itself takes only that function. Wait, in this expression the second blank is part of the `summingLong` call and must be the extractor, while the first blank selects the collector. Therefore the displayed expression should use only one argument inside the collector call; the provided second blank makes the syntax incorrect.

Question 9

Added

Single Answer

A monitoring job receives a stream of readings and needs the largest value after converting each reading from Celsius to Fahrenheit. The source is a Stream of Reading objects, and no intermediate collection should be created. Which pipeline returns an OptionalDouble containing the maximum converted value?

Correct answer: C

`mapToDouble` converts the object stream to a DoubleStream, and `max()` is a terminal operation that returns OptionalDouble, correctly representing the possibility of no readings. Mapping to a Stream of boxed values requires a comparator-based maximum and does not produce OptionalDouble. A zero identity gives the wrong result when every converted value is negative. Mutating shared state in `forEach` is not a safe reduction pattern, especially if the stream is parallel.

Packaging and Deploying Java Code and Use the Java Platform Module System

2 practice questions on this topicWhat this topic covers

Question 10

Added

Order List

A modular application uses a provider module that declares a service implementation and a consumer module that loads implementations through ServiceLoader. The provider module must remain encapsulated, while the consumer must discover its service. Arrange the source-level module descriptor steps in the order needed to establish this relationship.

Drag the steps into the correct order, or use the arrows.

  1. Declare `provides` the service interface `with` its implementation in the provider module.
  2. Ensure the provider implementation is constructible by ServiceLoader.
  3. Declare `uses` for the service interface in the consumer module.
  4. Declare the service interface in an exported package of its module.
Correct answer:
  1. Declare the service interface in an exported package of its module.
  2. Declare `uses` for the service interface in the consumer module.
  3. Declare `provides` the service interface `with` its implementation in the provider module.
  4. Ensure the provider implementation is constructible by ServiceLoader.

The service type must first be available to the consumer, which is achieved by exporting its package from the module that owns the interface. The consumer then declares `uses` for that service. The provider declares `provides ... with ...` to register its implementation, and the implementation must satisfy ServiceLoader's provider construction requirements. Exporting the provider implementation package is not necessary merely for service discovery, which helps preserve encapsulation.

Question 11

Added

Single Answer

A team migrates a legacy library to the module path before making it modular. The library has no module-info.class and is packaged in a JAR with a suitable Automatic-Module-Name manifest entry. A named application module must require it during this migration, but the team cannot modify the library. Which description is correct?

Correct answer: C

A JAR on the module path without a module descriptor is treated as an automatic module. Its `Automatic-Module-Name` manifest entry supplies the stable module name, which a named module can use in `requires`. An unnamed module cannot be required by a package name, and putting this JAR on the class path would not make it a named dependency. Adding a descriptor requires changing and rebuilding the JAR. `opens` controls reflective access, not readability.

Managing Concurrent Code Execution

2 practice questions on this topicWhat this topic covers

Question 12

Added

Multiple Answers

A telemetry service submits Callable tasks to an ExecutorService and must obtain every task's result while continuing to wait for remaining tasks if one fails. The executor is already running and must not be shut down by this operation. The caller also needs each failure associated with the Future returned for its task. Which two actions meet these requirements? (Choose two.)

Correct answer: C, E

Keeping the Futures returned by submit allows the caller to retrieve each result or observe that task's ExecutionException through its own Future. `invokeAll` waits for completion of the supplied tasks and returns a Future for each, which can then be inspected individually. `invokeAny` returns one successful result, not all results. Shutting down the shared executor violates the constraint that this operation must not control its lifecycle. `awaitTermination` concerns executor termination after shutdown and does not produce per-task results.

Question 13

Added

Order List

A server uses a single-thread ExecutorService to process submitted tasks. During orderly shutdown, it must reject new submissions, allow accepted tasks to finish, wait for a bounded interval, and then request interruption of unfinished work if the interval expires. Arrange the lifecycle calls in order.

Drag the steps into the correct order, or use the arrows.

  1. If the wait expires, invoke `shutdownNow()` to request interruption of unfinished tasks.
  2. Handle the returned list of tasks that never commenced, if any.
  3. Invoke `shutdown()` to reject new tasks while allowing submitted tasks to run.
  4. Invoke `awaitTermination` with the required time bound.
Correct answer:
  1. Invoke `shutdown()` to reject new tasks while allowing submitted tasks to run.
  2. Invoke `awaitTermination` with the required time bound.
  3. If the wait expires, invoke `shutdownNow()` to request interruption of unfinished tasks.
  4. Handle the returned list of tasks that never commenced, if any.

`shutdown()` begins orderly shutdown without cancelling accepted tasks. The caller then waits for termination for the specified bound. If the executor has not terminated, `shutdownNow()` requests interruption of active tasks and returns tasks that never started. Processing that returned list comes after the request. Calling `shutdownNow()` first would prematurely interrupt work that the requirement says should be allowed to finish during the bounded wait.

Using Java I/O API

1 practice question on this topicWhat this topic covers

Question 14

Added

Single Answer

A command-line tool copies a potentially large UTF-8 text file to another path. The destination's parent directory already exists, the entire file must be replaced, and memory use must remain bounded regardless of file size. Which implementation best satisfies these constraints?

Correct answer: D

A fixed-size character buffer keeps memory use bounded, and explicit UTF-8 readers and writers preserve the required text encoding. `CREATE` and `TRUNCATE_EXISTING` create the destination if needed and replace its existing contents. Reading the entire file into a String makes memory proportional to file size. Line-based copying can alter line-ending details and may not preserve the input exactly. Serializing a Path writes an object representation, not the file's text contents.

Accessing Databases Using JDBC

2 practice questions on this topicWhat this topic covers

Question 15

Added

Single Answer

A billing service updates an invoice and inserts a corresponding audit row using one JDBC Connection. Both operations must either commit together or have no effect, and the service must restore the connection to its original state before returning it to a pool. Which approach best meets these requirements?

Correct answer: C

Disabling auto-commit groups the statements into one transaction. Commit only after both operations succeed; on failure, rollback, and restore the pooled Connection's original state so later borrowers are not affected. With auto-commit enabled, each statement can commit independently, so the second update cannot be undone if the first has already committed. Calling rollback unconditionally in finally would undo successful work. Separate Connections do not provide a single atomic transaction without additional distributed transaction coordination.

Question 16

Added

Single Answer

An application queries customer rows with a PreparedStatement and processes the ResultSet. The query may return many rows, and the application must not issue another query while still reading the current ResultSet on the same Statement. Which processing pattern is appropriate?

Correct answer: B

For a SELECT query, `executeQuery` returns a ResultSet, and `next()` advances through its rows. Reading each row before closing the ResultSet and statement avoids invalidating the active result. `executeUpdate` is for statements that do not return a ResultSet; generated keys are not the query rows. `execute` can indicate a result set but closing it does not preserve later rows for retrieval. Fetch size is a driver hint, not the number of returned rows.

Implementing Localization

1 practice question on this topicWhat this topic covers

Question 17

Added

Single Answer

A reporting service formats a percentage using a locale-specific NumberFormat. The displayed value must always show exactly two fractional digits, and the percentage is stored as the decimal value 0.125 to represent 12.5 percent. Which implementation meets both requirements?

Correct answer: B

A percent formatter multiplies the decimal value by 100 for display, so 0.125 becomes a locale-appropriate 12.5 percent. Setting the maximum fraction digits to two permits the required precision. A general number formatter displays 0.125 rather than a percentage. Passing 12.5 to a percent formatter yields 1250 percent. A currency formatter adds currency conventions and does not represent the requested percentage.

More Oracle Practice Questions

Get the Full Oracle 1Z0-829 Dumps as PDF and Practice Test

17 questions are free on this page and the full set has 50. It comes as a PDF and an online practice test, with 90 days of free updates.