1z0-829 Exam QuestionsBrowse all questions from this exam

1z0-829 Exam - Question 5


Given the code fragment:

What is the result?

Show Answer
Correct Answer: B

The code fragment defines and prints a Duration and a Period. Initially, a Duration of 5000 milliseconds is created, which equals to 5 seconds and will be printed as PT5S. Then the Duration is updated to 60 seconds, which equals to 1 minute and will be printed as PT1M. Finally, a Period of 6 days is printed as P6D. Therefore, the output of the program will be PT5SPT1MP6D.

Discussion

4 comments
Sign in to comment
minhdevOption: B
May 5, 2024

Period: P#(Y,M,D) Duration: PT#(H, M, S) Result: PT5SPT1MP6D B is correct answer

SampsOption: B
Feb 10, 2024

B is correcct

james2033Option: B
Feb 11, 2024

package q05; import java.time.Duration; import java.time.Period; public class Q05 { public static void main(String[] args) { Duration duration = Duration.ofMillis(5000); System.out.print(duration); duration = Duration.ofSeconds(60); System.out.print(duration); Period period = Period.ofDays(6); System.out.print(period); } } // Result: // PT5SPT1MP6D

UtemanOption: B
Jul 2, 2024

B is correct