Question 21 · 52 in bank
Which statement is true about migration?
Show answer
Answer: B
Java SE 17 Developer52 questions across 6 pages are complete and free, with no account or card.
52 questions in this bank
Free access · progress saved on this device
Which statement is true about migration?
Answer: B
Daylight Saving Time (DST) is the practice of advancing clocks at the start of spring by one hour and adjusting them backward by one hour in autumn. Considering that in 2021, DST in Chicago (Illinois) ended on November 7th at 2 AM, and given the fragment:

What is the output?
Answer: C
package q03; import java.time.LocalDate; import java.time.LocalTime; import java.time.ZoneId; import java.time.ZonedDateTime; public class Q03 { public static void main(String[] args) { ZoneId zoneId = ZoneId.of("America/Chicago"); ZonedDateTime zdt = ZonedDateTime.of( LocalDate.of(2021, 11, 7), LocalTime.of(1, 30), zoneId ); ZonedDateTime anHourLater = zdt.plusHours(1); System.out.println(zdt.getHour() == anHourLater.getHour()); System.out.print(zdt.getOffset().equals(anHourLater.getOffset())); } } // Result: // true // false
Source: Adapted from community discussion — james2033
Assuming that the data.txt file exists and has the following content: text1 text2 text3 Given the code fragment:

What is the result?
Answer: B
Given:

Which action enables the code to compile?
Answer: A
Correct answer is A, tested in online compiler. static methods cannot access instance variable unless they are static. That is to say: - either the "name" variable must be made static so that it can be accessed by the display() method on line 3 - or the display() method on line 3 must be made non-static (remove the static keyword) so that it can access the "name" variable Only alternative that achieves one of these two is A. Note that despite this change, i1.display("Flower") will still call the display() method on line 7. Non-static methods are allowed to access static instance variable regardless. In this case, since both "this.name" and "name" are null, "this.name += name;" will simply do "null += null;" and the result will be "nullnull".
Source: Adapted from community discussion — supersquax
Given:
and the code fragment:

What is the result?
Answer: A
package q33; import java.util.Arrays; public class Q33 { public static void main(String[] args) { Arrays.stream(Desig.values()).dropWhile(s -> s.equals(Desig.CMO)); switch (Desig.valueOf("CMO")) { case CEO -> System.out.println("Executive"); case CMO -> System.out.println("Marketing"); case CFO -> System.out.println("Finance"); case CTO -> System.out.println("Technical"); default -> System.out.println("UnDefined"); } } } // Result: // Marketing
Source: Adapted from community discussion — james2033
Given:

What is the result?
Answer: B
package q34; public class Test { public void sum(int a, int b) { System.out.print(" A"); } public void sum(int a, float b) { System.out.print(" B"); } public void sum(float a, float b) { System.out.print(" C"); } public void sum(double... a) { System.out.print(" D"); } public static void main(String[] args) { Test t = new Test(); t.sum(10, 15.25); t.sum(10, 24); t.sum(10.25, 10.25); } } // Result: // D A D
Source: Adapted from community discussion — james2033
Given:

What is the result?
Answer: B
Given:

Which two method invocations execute? (Choose two.)
Answer: AE
Given the directory structure:
Given the definition of the Doc class:
Which two are valid definitions of the WordDoc class? (Choose two.)
Answer: BF
A wrong cuz "package p1.p2" doesnt make sense B correct C wrong cuz no access modifier is more restrictive than public and not allowed. D wrong cuz when using "sealed", one must also use "permits" E wrong cuz missing "sealed", "non-sealed", or "final" F correct.
Source: Adapted from community discussion — supersquax
Given:

What is the result?
Answer: B
A This code has a compilation error because the reduce method expects elements of the same type as the accumulator function's arguments.
Source: Adapted from community discussion — xplorerpj
Keyboard:J Kmove between questionsA–Dselect an answerRshow or hide the answer← →change page
1Z0-829 practice, question 21. 52 questions available.
Version 1.0.0. How we source questions