Dates and Times

Dates and Times

University

11 Qs

quiz-placeholder

Similar activities

English Tenses

English Tenses

University

10 Qs

APP-grade your app knowledge!

APP-grade your app knowledge!

University

11 Qs

ES - Classificações de Rede de Comunicação

ES - Classificações de Rede de Comunicação

University

13 Qs

ADMINISTRASI SISTEM JARINGAN (XI TKJ)

ADMINISTRASI SISTEM JARINGAN (XI TKJ)

University

15 Qs

ADMINISTRASI SISTEM JARINGAN (XII TKJ)

ADMINISTRASI SISTEM JARINGAN (XII TKJ)

University

15 Qs

Non-Digital Instructional Materials

Non-Digital Instructional Materials

University

10 Qs

FUN 101 week 1

FUN 101 week 1

University

13 Qs

Time Telling

Time Telling

University

12 Qs

Dates and Times

Dates and Times

Assessment

Quiz

Instructional Technology

University

Medium

Created by

Kevin Tinsley

Used 5+ times

FREE Resource

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When compared with the new date/time API that was introduced with Java 8, what is an advantage of the old date/time API?

It’s thread-safe.

It’s intuitive.

It’s easier to localize for parts of the world that don’t use the Gregorian calendar.

It works with versions of Java prior to Java 8.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What package stores the LocalDateTime class?

java.util

java.text

java.time

java.date

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is true about a LocalDate object?

It represents a date only.

It works from the observer’s perspective.

It represents a time only.

Both a and b.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If the current time is 5pm, what is printed to the console? LocalTime now = LocalTime.now(); LocalTime startTime = LocalTime.of(15, 30); if (now.compareTo(startTime) < 0) { System.out.println("early"); } else if (now.compareTo(startTime) > 0) { System.out.println("late"); } else if (now.compareTo(startTime) == 0) { System.out.println("on time"); }

early

late

on time

nothing

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements gets the month from a LocalDate object named now?

int month = now.getMonth();

int month = now.getMonthInt();

Month month = now.getMonth();

Month month = now.getMonthInt();

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given a LocalDate object named date, which of the following statements changes the day of the month to the 12th?

LocalDate newDate = date.withDayOfMonth(12);

LocalDate newDate = date.setDayOfMonth(12);

LocalDate newDate = date.withDay(12);

LocalDate newDate = date.setDay(12);

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given a LocalDateTime object named now that stores the current date and time, which of the following statements gets a new LocalDateTime object that’s four weeks in the future?

LocalDateTime newDateTime = now.incrementWeeks(4);

LocalDateTime newDateTime = now.addWeeks(4);

LocalDateTime newDateTime = now.plusWeeks(4);

LocalDateTime newDateTime = now.plus(WEEKS, 4);

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?