nerdexam
Oracle

1Z0-829 · Question #33

Daylight Saving Time (DST) is the practice of advancing clocks at the start of spring by one hour and adjusting them backward by one hour in autumn. Considering that in 2021, DST in Chicago…

The correct answer is A. true false. On DST's end day in Chicago, clocks "fall back" at 2:00 AM - meaning 1:30 AM CDT (UTC-5) + 1 hour = 1:30 AM CST (UTC-6), not 2:30 AM. Both zdt.getHour() and anHourLater.getHour() return 1, so the hour comparison prints true; however, the two ZonedDateTime objects are not equal…

Handling date, time, text, numeric and boolean values

Question

Daylight Saving Time (DST) is the practice of advancing clocks at the start of spring by one hour and adjusting them backward by one hour in autumn. Considering that in 2021, DST in Chicago (Illinois) ended on November 7th at 2 AM, and given the fragment: ZonedDateTime zdt = ZonedDateTime.of( zoneID.of("America/Chicago"), ZonedDateTime.zdt = ZonedDateTime.of( LocalDate.of(2021, 11, 7), LocalTime.of(1, 30), zoneID )); ZonedDateTime anHourLater = zdt.plusHours(1); System.out.println(zdt.getHour() == anHourLater.getHour()); What is the output?

Options

  • Atrue false
  • Bfalse true
  • Ctrue true
  • Dfalse false
  • Etrue null

How the community answered

(28 responses)
  • A
    57% (16)
  • B
    11% (3)
  • C
    4% (1)
  • D
    4% (1)
  • E
    25% (7)

Explanation

On DST's end day in Chicago, clocks "fall back" at 2:00 AM - meaning 1:30 AM CDT (UTC-5) + 1 hour = 1:30 AM CST (UTC-6), not 2:30 AM. Both zdt.getHour() and anHourLater.getHour() return 1, so the hour comparison prints true; however, the two ZonedDateTime objects are not equal because they represent different instants (different UTC offsets: -05:00 vs -06:00), so the equals() comparison prints false - giving output A.

Why the distractors fail:

  • B (false/true): The hour values are the same (both 1), so the first line can't be false; and equals() can't be true when the offsets differ.
  • C (true/true): equals() compares both local time and offset, so two ZonedDateTimes at 1:30 AM with different offsets are never equal.
  • D (false/false): Both lines are wrong - the hour comparison is true, not false.
  • E (true/null): plusHours() always returns a valid ZonedDateTime; it never produces null.

Memory tip: Think "Fall Back = same digit, new offset." On a fall-back night, adding one clock-hour lands you on the same local hour in the new timezone offset, so getHour() matches - but the timestamps are different instants, so equals() still fails.

Topics

#ZonedDateTime#Daylight Saving Time#Timezone transitions#DST ambiguity

Community Discussion

No community discussion yet for this question.

Full 1Z0-829 Practice