Courseiva

1Z0-829 · domain

Handling Date, Time, Text, Numeric and Boolean Values

Practise Oracle Certified Professional Java SE 17 Developer 1Z0-829 Handling Date, Time, Text, Numeric and Boolean Values practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

34 questions8 easy15 medium11 hard

Focused practice

Practice Handling Date, Time, Text, Numeric and Boolean Values questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about Handling Date, Time, Text, Numeric and Boolean Values

Handling Date, Time, Text, Numeric and Boolean Values questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Handling Date, Time, Text, Numeric and Boolean Values exam traps

  • Answering from memory before reading the full scenario.
  • Missing a constraint such as cost, availability, security, scope or command context.
  • Choosing a broad answer when the question asks for the most specific fix.
  • Ignoring why the wrong options are tempting.

Question index

All Handling Date, Time, Text, Numeric and Boolean Values questions (34)

Click any question to see the full explanation, or start a practice session above.

1

Given the exhibit, what is the output? (Assume America/New_York observes daylight saving time, with spring forward on March 12, 2023 at 2:00 AM to 3:00 AM.)

Hard
2

Which three of the following are valid methods in the String class in Java 17? (Choose three.)

Easy
3

What is the result of executing the following code snippet? BigDecimal d1 = new BigDecimal("1.00"); BigDecimal d2 = new BigDecimal("1.0"); System.out.println(d1.equals(d2));

Hard
4

Which of the following correctly uses DateTimeFormatter to parse the date "2023-01-15" into a LocalDate?

Medium
5

Which two statements about the java.time.Duration class are true? (Choose two.)

Medium
6

Which code correctly reads a line of text from the console using System.console()?

Hard
7

What is the output?

Medium
8

Given the exhibit, what is the output?

Medium
9

Which TWO of the following are valid ways to create a LocalDate object in Java 17?

Easy
10

Refer to the exhibit. Which Java code correctly performs the equivalent timezone conversion?

Hard
11

Refer to the exhibit. What is the output?

Easy
12

A program reads user input as a string and needs to parse it into an integer, handling invalid input gracefully. Which code snippet correctly uses try-catch to parse and prints the result or 'Invalid number'?

Medium
13

A financial application uses Java SE 17 with a custom date format. The requirement is to parse strings like "2023-12-31T23:59:59.999Z" into an Instant. The existing code uses SimpleDateFormat with pattern "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" and then calls parse(). It works fine in single-threaded testing, but in production under load, intermittent parsing failures occur with DateTimeParseException or wrong values. The application is multi-threaded and reuses the same formatter instance. Which single change should be made to fix the issue while maintaining performance?

Hard
14

What is the output of the code in the exhibit?

Medium
15

Which two of the following are valid ways to create a LocalDate representing the current date in the system's default timezone? (Choose two.)

Hard
16

Given: ZonedDateTime zdt = ZonedDateTime.of(2024, 3, 10, 2, 30, 0, 0, ZoneId.of("America/New_York")); In the US, on March 10, 2024, clocks spring forward at 2:00 AM to 3:00 AM. What is the output of System.out.println(zdt);?

Hard
17

Which of the following correctly formats a NumberFormat instance to display a currency value for the US locale with exactly two decimal places, rounding half-up?

Easy
18

Which TWO statements correctly use the DateTimeFormatter class? (Choose two.)

Easy
19

A developer is writing a method that takes a LocalDate and a ZoneId and returns the current time in that time zone as an OffsetDateTime. Which approach correctly implements this?

Medium
20

Which TWO statements are true about the java.time.Duration class? (Choose two.)

Hard
21

Which method checks if a String is empty or contains only whitespace?

Easy
22

Arrange the steps to create a custom exception class in Java in the correct order.

Medium
23

Match each annotation to its retention policy.

Medium
24

Arrange the steps to use a lambda expression to sort a list of strings by length.

Medium
25

A financial application uses BigDecimal for monetary calculations. Which rounding mode should be used to round to the nearest neighbor, and if both neighbors are equidistant, round to the even neighbor?

Medium
26

A developer needs to parse a date string '2024-07-04' into a LocalDate object. Which approach is correct?

Easy
27

A company's Java application processes time-sensitive data from IoT sensors. The system must handle timestamps across multiple time zones. The application runs on a server set to UTC. Developers have been using java.util.Date and SimpleDateFormat for date parsing. Recently, there have been intermittent failures where timestamps from sensors in the America/New_York time zone are parsed incorrectly around daylight saving time transitions. Specifically, during the spring forward (March 12, 2023, at 2:00 AM EST to 3:00 AM EDT), timestamps like "2023-03-12 02:30:00" are being interpreted as times that do not exist, causing DateTimeParseException. The team decides to migrate to the java.time API. They need to parse sensor timestamps that include a time zone offset (e.g., "2023-03-12 02:30:00 -05:00") into an OffsetDateTime. Which course of action correctly parses the timestamp and handles the DST issue?

Hard
28

Which THREE statements are true about the Boolean class? (Choose three.)

Medium
29

Match each Java keyword to its primary purpose.

Medium
30

Refer to the exhibit. Which concept does this error relate to?

Medium
31

Which of the following correctly formats a LocalDateTime object into a string with pattern 'dd/MM/yyyy HH:mm:ss'?

Medium
32

A financial application processes a large log file containing millions of timestamp entries in two different formats: "2024-01-15T10:30:00Z" (ISO 8601) and "01/15/2024 10:30:00 AM" (US locale). The current implementation uses a single DateTimeFormatter with a pattern that throws an exception for the other format. The team wants to parse both formats efficiently without using try-catch for each line. Performance is critical, and the code must be thread-safe. Which approach should be used?

Hard
33

Which of the following correctly creates a text block in Java?

Easy
34

A developer needs to parse the string "2023-12-31T23:59:60Z" (a leap second) into a java.time.Instant. Which statement is true?

Hard

Frequently asked questions

What does the Handling Date, Time, Text, Numeric and Boolean Values domain cover on the 1Z0-829 exam?
Handling Date, Time, Text, Numeric and Boolean Values questions test whether you can apply the concept in context, not just recognise a definition.
How many questions are in this domain?
This page lists all 34 Handling Date, Time, Text, Numeric and Boolean Values questions in the 1Z0-829 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only Handling Date, Time, Text, Numeric and Boolean Values questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
oracle-ocp-java17 ORACLE-OCP-JAVA17 java data types Practice Questions