• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Possible typo in answer of question 68 in chapter 1 (Practice Tests)

 
Ranch Hand
Posts: 72
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I think there is a typo in the answer for question 68 in chapter 1.  

C.  Normally, adding an hour would result in `02:00` in the same time zone offset of `-05:00`.  Since the hour is repeated, it is `01:00` again.  However, the time zone offset changes instead. Therefore, option C is correct.



The question indicates that the time is 2012-11-06T01:00-04:00[America/New_York], which has a time zone offset of -04:00, and not -05:00 as the answer indicated.
 
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have the book so I don't know if I'm interpreting the answer correctly, but the difference you're seeing seems to be explained by the answer. Emphasis mine:


C.  Normally, adding an hour would result in `02:00` in the same time zone offset of `-05:00`.  Since the hour is repeated, it is `01:00` again.  However, the time zone offset changes instead. Therefore, option C is correct.

 
Albert Attard
Ranch Hand
Posts: 72
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply.

The question reads like this.

Daylight saving time ends on November 6, 2022 at 2 a.m., when we repeat the hour. Suppose we have a ZonedDateTime that outputs 2012-11-06T01:00-04:00[America/New_York] when calling toString(). What is a possible value of the ZonedDateTime obtained by adding an hour to this value?



Unless I am misunderstanding the answer, it is saying that on any other given day, the hour would move by 1 while the time zone offset will not change and stay as is, -5:00 in this case.  But based on the question, the time zone offset is -4:00 and not -5:00.
 
Stephan van Hulst
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see the issue. There is an error in the question and an error in the answer.

The question mentions a ZonedDateTime that outputs "2012-11-06T01:00-04:00[America/New_York]". The intended year was probably 2022, because in 2012 daylight savings already ended on the 4th of november in New York.

The answer says that the offset is -05:00, however the offset during daylight savings time in New York is -04:00. The offset will only be -05:00 when daylight savings time ends, an hour later.

So yes, you're correct. Consider this small application:

This outputs the following:
 
Albert Attard
Ranch Hand
Posts: 72
5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right.  I tried the same example, and I thought I copied the wrong date and fixed it in my example without checking the question again.

For completeness there are four options in the answers, all with year 2022.

A. 2022-11-06T01:00-04:00[America/New_York]
B. 2022-11-06T02:00-04:00[America/New_York]
C. 2022-11-06T01:00-05:00[America/New_York]
D. 2022-11-06T02:00-05:00[America/New_York]



I checked again after reading your message and now I realised why this didn’t work as expected in my first try.  Thank you for pointing it out.
 
author & internet detective
Posts: 42148
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I logged 2012 vs 2022 in the errata. What's wrong with the answer?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic