0% found this document useful (0 votes)
33 views

Course:: Easy-To-Follow Java Programming

The document provides questions and answers about representing and working with date/time in Java. [1] Date, Calendar, and long can represent date/time in the "first solution" handling. [2] A fully specified date/time needs the time, date, and time zone. [3] The ZonedDateTime class is needed to store a fully specified date/time.

Uploaded by

Fuad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Course:: Easy-To-Follow Java Programming

The document provides questions and answers about representing and working with date/time in Java. [1] Date, Calendar, and long can represent date/time in the "first solution" handling. [2] A fully specified date/time needs the time, date, and time zone. [3] The ZonedDateTime class is needed to store a fully specified date/time.

Uploaded by

Fuad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Course: Easy-to-follow Java programming

The quiz questions


Answer the questions below to review what you have learned in Video 10. You will
find the right answers after the questions in the solution part.

1. What can represent a date/time in the „first solution” date/time handling?

Date

double

DateTime

Calendar

long

LocalDateTime

2. What do you need to get a fully specified date/time?

Time

Geographical latitude

Date

Moon phase

Time zone

Duckademy IT courses – www.duckademy.com


3. What class do you need from the following if you want to store a fully
specified date/time?

LocalDate

ZonedDateTime

Year

LocalDateTime

LocalTime

4. What properties are stored by OffsetDateTime?

Moon phase

Hours

Seconds

Full time zone

Time zone offset

Month

5. What is the difference between Duration and Period?

Duration is based on seconds while Period is based on calendar


units.

Period is based on seconds while Duration is based on calendar


units.

Period is for containing recurring times while Duration is for


containing single time points.

Period is for containing date/time difference that is longer than one


year while Duration is for containing date/time difference for less
than a year.

Period works only with zoned or offset date/time while Duration


can make calculations based on local date/time.

Duckademy IT courses – www.duckademy.com


6. What is true for ZoneId in comparision with ZoneOffset?

ZoneId is specified by place not by the difference from UTC.

ZoneId handles daylight saving time, ZoneOffset does not.

ZoneId is simpler to calculate with than ZoneOffset.

ZoneId does not handle daylight saving time, ZoneOffset does.

ZoneOffset is simpler to calculate with than ZoneId.

Duckademy IT courses – www.duckademy.com


----------------------------------------------------------------------------------------------------------------

The answers

1. What can represent a date/time in the „first solution” date/time handling?

X Date

double

DateTime

X Calendar

X long

LocalDateTime

2. What do you need to get a fully specified date/time?

X Time

Geographical latitude

X Date

Moon phase

X Time zone

3. What class do you need from the following if you want to store a fully
specified date/time?

LocalDate

X ZonedDateTime

Year

LocalDateTime

LocalTime

Duckademy IT courses – www.duckademy.com


4. What properties are stored by OffsetDateTime?

Moon phase

X Hours

X Seconds

Full time zone

X Time zone offset

X Month

5. What is the difference between Duration and Period?

X Duration is based on seconds while Period is based on


calendar units.

Period is based on seconds while Duration is based on calendar


units.

Period is for containing recurring times while Duration is for


containing single time points.

Period is for containing date/time difference that is longer than one


year while Duration is for containing date/time difference for less
than a year.

Period works only with zoned or offset date/time while Duration


can make calculations based on local date/time.

6. What is true for ZoneId in comparision with ZoneOffset?

X ZoneId is specified by place not by the difference from UTC.

X ZoneId handles daylight saving time, ZoneOffset does not.

ZoneId is simpler to calculate with than ZoneOffset.

ZoneId does not handle daylight saving time, ZoneOffset does.

X ZoneOffset is simpler to calculate with than ZoneId.

Duckademy IT courses – www.duckademy.com

You might also like