Java SE 8 Programmer II Free Practice Exam Questions

122 real Java SE 8 Programmer II exam questions with answers and AI explanations. Oracle certification prep — page 1 of 13.

  1. Question 1: Given the code fragment: public class Foo { public static void main (String [ ] args) { Map<Integer, String> unsortMap = new HashMap< > ( ); unsortMap.put (10,…
  2. Question 2: Given the definition of the Vehicle class: Class Vehhicle { int distance; //line n1 Vehicle (int x) { this distance = x; } public void increSpeed(int time) { /…
  3. Question 3: Given the code fragment: Path source = Paths.get ("/data/december/log.txt"); Path destination = Paths.get("/data"); Files.copy (source, destination); /data/dec…
  4. Question 4: Given: public class Counter { public static void main (String[ ] args) { int a = 10; int b = -1; assert (b >=1) : "Invalid Denominator"; int = a / b; System.ou…
  5. Question 5: Given the code fragment: BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2; //line n1 System.out.println(val.apply(10, 10.5)); What is the result?
  6. Question 6: java.time.Duration? Which statement is true about -
  7. Question 7: Given the code fragment: List<Integer> list1 = Arrays.asList(10, 20); List<Integer> list2 = Arrays.asList(15, 30); //line n1 Which code fragment, when inserted…
  8. Question 8: Given the code fragment: public static void main (String[] args) throws IOException { BufferedReader brCopy = null; try (BufferedReader br = new BufferedReader…
  9. Question 9: Given: Book.java: public class Book { private String read(String bname) { return "Read" + bname } } EBook.java: public class EBook extends Book { public class…
  10. Question 10: Given the code fragment: LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14); LocalDate nextYear = valentinesDay.plusYears(1); nextYear.plusDays(15…