Courseiva

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

Exhibit

Refer to the exhibit.

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
ZonedDateTime zdt = ZonedDateTime.parse("2023-03-12 02:30:00 America/New_York", formatter);
System.out.println(zdt);

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.)

⚠ Common exam trap

A common mix-up: candidates assume the API will automatically adjust the time to the next valid moment (e.g., 03:30) or use the pre-transition offset, but the exam tests that ZonedDateTime.of() throws an exception for non-existent local times during DST gaps.

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

A DateTimeException is thrown.

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.

Answer analysis

Option-by-option breakdown

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

  • null is printed.

    Why it's wrong here

    An exception is thrown, not null.

  • 2023-03-12T03:30:00-04:00[America/New_York]

    Why it's wrong here

    Would be if the time existed after spring forward? Actually 02:30 would become 03:30? But parsing fails.

  • A DateTimeException is thrown.

    Why this is correct

    The time 02:30 does not exist due to DST gap.

  • 2023-03-12T02:30:00-05:00[America/New_York]

    Why it's wrong here

    Would be before spring forward, but the time is after 2:00.

About these practice questions

One of 513 original 1Z0-829 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.