Courseiva

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

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

⚠ Common exam trap

Many exam-takers assume '60' seconds is always invalid and will cause an exception, but the Java Time API specifically accommodates leap seconds by converting them to the nearest valid nanosecond-adjusted Instant.

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

It returns an Instant representing 2023-12-31T23:59:59Z with an added nanosecond.

Java.time.Instant.parse() handles leap seconds by converting them to the last valid second of the minute (23:59:59) and then adding a nanosecond to account for the extra second. This behavior is specified by the ISO-8601 standard and the Java Time API, which does not support a true 60th second but represents it as an Instant with a fractional second adjustment.

Answer analysis

Option-by-option breakdown

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

  • It returns an Instant representing 2023-12-31T23:59:59Z, ignoring the leap second.

    Why it's wrong here

    Leap second is not ignored; it is handled.

  • It returns an Instant representing 2023-12-31T23:59:59Z with an added nanosecond.

    Why this is correct

    The 60th second is treated as the last nanosecond of the minute.

  • It throws a DateTimeParseException because 60 seconds is invalid.

    Why it's wrong here

    Instant.parse handles leap seconds.

  • It returns null because the string is invalid.

    Why it's wrong here

    It returns an Instant, not null.

About these practice questions

This 1Z0-829 question is part of Courseiva's 513-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.