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 4 of 13.

  1. Question 31: The data.doc, data.txt and data.xml files are accessible and contain text. Given the code fragment: Stream<Path> paths = Stream.of (Paths. get("data.doc"), Pat…
  2. Question 32: Given: final class Folder { //line n1 //line n2 public void open () { System.out.print("Open"); } } public class Test { public static void main (String [] args…
  3. Question 33: Given the code fragment: 9. Connection conn = DriveManager.getConnection(dbURL, userName, passWord); 10. String query = "SELECT id FROM Employee"; 11. try (Sta…
  4. Question 34: Given the code fragment: UnaryOperator<Integer> uo1 = s -> s*2; line n1 List<Double> loanValues = Arrays.asList(1000.0, 2000.0); loanValues.stream() .filter(lv…
  5. Question 35: Given: class RateOfInterest { public static void main (String[] args) { int rateOfInterest = 0; String accountType = "LOAN"; switch (accountType) { case "RD";…
  6. Question 36: Given: class CheckClass { public static int checkValue (String s1, String s2) { return s1 length() s2.length(); } } and the code fragment: String[] strArray =…
  7. Question 37: Given the code fragments: class TechName { String techName; TechName (String techName) { this.techName=techName; } } and List<TechName> tech = Arrays.asList (…
  8. Question 38: Given: interface Doable { public void doSomething (String s); } Which two class definitions compile? (Choose two.)
  9. Question 39: You want to create a singleton class by using the Singleton design pattern. Which two statements enforce the singleton nature of the design?
  10. Question 40: Given the code fragment: ZonedDateTime depart = ZonedDateTime.of(2015, 1, 15, 3, 0, 0, 0, ZoneID.of("UTC-7")); ZonedDateTime arrive = ZonedDateTime.of(2015, 1,…