Question 237 of 509

Quick Answer

The answer is 2024-03-10T03:30-04:00[America/New_York]. This output occurs because ZonedDateTime’s handling of the DST spring-forward gap automatically resolves an invalid local time by shifting it forward to the next valid offset. When you attempt to create a ZonedDateTime for 2:30 AM on March 10, 2024, in the America/New_York time zone, that local time does not exist—clocks jump directly from 2:00 AM to 3:00 AM. The Java API normalizes the nonexistent time by advancing it by the duration of the gap, resulting in 3:30 AM with the daylight saving offset of -04:00. On the Oracle Certified Professional Java SE 17 Developer 1Z0-829 exam, this concept tests your understanding of how the `ZonedDateTime.of` method resolves temporal anomalies, a common trap where candidates expect an exception or the original invalid time. Remember the key rule: gaps spring forward, overlaps fall back. For a quick memory tip, think “gap = jump ahead” to recall that invalid gap times are always pushed to the later offset.

1Z0-829 Practice Question: Handling Date, Time, Text, Numeric and Boolean Values

This 1Z0-829 practice question tests your understanding of handling date, time, text, numeric and boolean values. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

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);?

Question 1hardmultiple choice
Full question →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

2024-03-10T03:30-04:00[America/New_York]

When a ZonedDateTime is created for a time that falls within a DST gap (2:00 AM to 3:00 AM on March 10, 2024, in America/New_York), the Java API automatically adjusts the time forward to the next valid offset. The local time 2:30 AM does not exist because clocks spring forward to 3:00 AM, so the ZonedDateTime is normalized to 3:30 AM with the DST offset -04:00. This behavior is defined by the ZonedDateTime.of method, which resolves invalid local times by shifting to the offset after the gap.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Throws DateTimeException

    Why it's wrong here

    Incorrect: ZonedDateTime.of does not throw an exception; it adjusts the time.

  • 2024-03-10T02:30-05:00[America/New_York]

    Why it's wrong here

    Incorrect: This represents EST, but at 2:30 AM the time does not exist; Java automatically adjusts.

  • 2024-03-10T02:30-04:00[America/New_York]

    Why it's wrong here

    Incorrect: The offset -04:00 indicates EDT, but the time 2:30 does not exist on that date; Java does not preserve the time with the EDT offset.

  • 2024-03-10T03:30-04:00[America/New_York]

    Why this is correct

    Correct: Java adjusts to the valid time 3:30 AM EDT (offset -04:00).

    Related concept

    Read the scenario before looking for a memorised answer.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates assume an invalid local time (like 2:30 AM during a spring-forward) will throw an exception or be stored as-is with the pre-gap offset, but Java silently adjusts the time forward to the next valid offset, changing both the time and the offset.

Detailed technical explanation

How to think about this question

Under the hood, ZonedDateTime.of calls ZoneRules.getOffset(LocalDateTime) which, for a gap, returns the offset after the transition (the DST offset). The local date-time is then resolved by adding the duration of the gap (1 hour) to the local time, effectively moving it to the first valid instant after the transition. This behavior aligns with the IANA time zone database rules for America/New_York, where the DST transition occurs at 2:00 AM EST to 3:00 AM EDT.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the 1Z0-829 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related 1Z0-829 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free 1Z0-829 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this 1Z0-829 question test?

Handling Date, Time, Text, Numeric and Boolean Values — This question tests Handling Date, Time, Text, Numeric and Boolean Values — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: 2024-03-10T03:30-04:00[America/New_York] — When a ZonedDateTime is created for a time that falls within a DST gap (2:00 AM to 3:00 AM on March 10, 2024, in America/New_York), the Java API automatically adjusts the time forward to the next valid offset. The local time 2:30 AM does not exist because clocks spring forward to 3:00 AM, so the ZonedDateTime is normalized to 3:30 AM with the DST offset -04:00. This behavior is defined by the ZonedDateTime.of method, which resolves invalid local times by shifting to the offset after the gap.

What should I do if I get this 1Z0-829 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more ways this is tested on 1Z0-829

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 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
  • A.null is printed.
  • B.2023-03-12T03:30:00-04:00[America/New_York]
  • C.A DateTimeException is thrown.
  • D.2023-03-12T02:30:00-05:00[America/New_York]

Why C: Option C is correct because attempting to create a ZonedDateTime for 2023-03-12 at 02:30 in the America/New_York timezone results in a DateTimeException. This is due to the daylight saving time 'spring forward' transition at 2:00 AM, when clocks jump directly to 3:00 AM, making the time 02:30 non-existent in that timezone. The java.time API strictly validates local date-time values against the timezone's offset transitions and throws an exception for invalid local times.

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.