Answer all 10 questions, then submit to see your score.
1. When using Arrays.asList() on an array, what type of List is returned?
2. Identify the best practices when working with wrapper classes.
3. Which of the following statements about enums are true?
4. What will this code print?
LocalDate d1 = LocalDate.of(2026, 1, 31); LocalDate d2 = d1.plusDays(1); System.out.println(d1);
5. Which of the following statements about Duration, Period, and ChronoUnit are true?
6. Which of the following statements about autoboxing and autounboxing are true?
7. Which of the following are best practices when working with strings in Java? (Select all that apply)
8. What will this code print? (Assume no setAccessible(true) call is made.)
class Secret { private String code = "1234"; } Field f = Secret.class.getDeclaredField("code"); try { Object value = f.get(new Secret()); System.out.println(value); } catch (IllegalAccessException e) { System.out.println("access denied"); }
9. Which of the following are common mistakes when working with Strings in Java?
10. What will the resulting file contain after this code runs?
try (BufferedWriter w = new BufferedWriter(new FileWriter(path.toFile()))) { w.write("Line1"); w.write("Line2"); }