exam questions

Exam 1z0-829 All Questions

View all questions & answers for the 1z0-829 exam

Exam 1z0-829 topic 1 question 83 discussion

Actual exam question from Oracle's 1z0-829
Question #: 83
Topic #: 1
[All 1z0-829 Questions]

Given the code fragment:

LocalDate now = LocalDate.now();
LocalDate this_labourDay = LocalDate.of(2021, Month.MAY, 1); LocalDate next_labourDay = this_labourDay.plusYears(1);
LocalDate add_week = next_labourDay.plusDays(7);
Period p = now.until(add_week);
System.out.println(p);

Assume LocalDate.now() returns 17th Aug 2021.

What is the result?

  • A. 21D8M
  • B. P8M21D
  • C. 08-MAY-2022
  • D. 1Y0M7D
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
unix105
3 weeks, 2 days ago
Selected Answer: B
start date: 8/17/2021 end date: 5/8/2022 days difference: * perform (end day - start day): 8 - 17 * if end day is less than start day, borrow numbers of days in previous month of end day * April has 30 days add that to end day (8 + 30 = 38) * then re-perform (end day - start day): 38 - 17 = 21 * adjusted end date is: 4/8/2022 months difference: * perform (end month - start month): 4 - 8 * if end month is less than start month, borrow 12 months in the previous year of end month * 2021 is end's month previous year then we add its 12 months (4 + 12 = 16) * then re-perform (end month - start month): 16 - 8 = 8 * adjusted end date is 4/8/2021 year difference: * performed (end year - start year): 2021 - 2021 = 0 * result: P8M21D
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...