Sample questions
Oracle Certified Professional Java SE 17 Developer 1Z0-829 practice questions
What does the Map.merge() method do if the specified key is absent?
A developer is designing a service that processes multiple files concurrently. To avoid resource leaks, which practice is essential?
A developer runs the command above on a JAR file. Which statement accurately describes the module myapp?
Which TWO statements about lambda expressions are true? (Choose two.) A. A lambda expression can be assigned to a functional interface variable. B. A lambda expression can access f…
Working with Streams and Lambda ExpressionshardSee the answer and why each option is right or wrong →Which THREE of the following are true about the Optional class? (Choose three.)
Working with Streams and Lambda ExpressionshardSee the answer and why each option is right or wrong →Given the following switch statement: ```java int x = 2; switch (x) { default: System.out.print("default "); case 1: System.out.print("1 "); case 2:…
A developer needs to read all lines from a text file named "data.txt" that uses UTF-8 encoding. Which code correctly reads the file using the NIO.2 API?
What does the following code print? List<Integer> list = new ArrayList<>(List.of(1,2,3)); list.replaceAll(x -> x * 2); System.out.println(list);
Consider the following code: ```java boolean a = true, b = false, c = false; if (a && b || c) { System.out.println("True"); } else { System.out.println("False"); } ``` Wh…
Refer to the exhibit. The exhibit shows a code snippet. What is the output when the variable day is set to Day.WEDNESDAY?
Which of the following will compile without error and produce an unmodifiable list containing three elements?
Given: Map<String, Integer> map = new HashMap<>(); map.put("x", 10); map.put("y", 20); map.computeIfAbsent("x", k -> 30); map.computeIfPresent("z", (k,v) -> 40); System.out.println…
Which of the following correctly creates a text block in Java?
Handling Date, Time, Text, Numeric and Boolean ValueseasySee the answer and why each option is right or wrong →Refer to the exhibit. What is the output?
Working with Streams and Lambda ExpressionsmediumSee the answer and why each option is right or wrong →Which THREE statements are true about loops in Java?
You are developing a batch processing application that reads records from a CSV file and parses each row into an integer ID. The reading method readNextRecord() returns a String an…
A team is developing a large enterprise application using Java 17. The application consists of multiple modules: core (provides logging and configuration), services (business logic…
Which TWO of the following are valid ways to create a LocalDate object in Java 17?
Handling Date, Time, Text, Numeric and Boolean ValueseasySee the answer and why each option is right or wrong →A financial application deserializes objects received over the network using ObjectInputStream. To prevent deserialization attacks, which secure coding practice should be implement…
Which THREE are methods of the Map.Entry interface? (Java 17)
Given the following code: ```java outer: for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (i == 1) { continue outer; } System…
A developer wants to traverse a directory tree to find all files that are symbolic links. Which NIO.2 method should be used to follow symbolic links during traversal?
Order the steps to create an immutable class in Java.
A developer runs 'java --list-modules' and sees the output above. Which command can be used to create a custom runtime image containing only the 'java.base' module?