Courseiva
Back to Oracle Certified Professional Java SE 17 Developer 1Z0-829 questions

Scenario-based practice

Refer to the Exhibit Practice Questions

Practise Oracle Certified Professional Java SE 17 Developer 1Z0-829 practice questions — original exam-style scenarios covering every exam domain, with detailed explanations, wrong-answer analysis, and common exam traps.

15
scenario questions
1Z0-829
exam code
Oracle
vendor

Scenario guide

How to approach refer to the exhibit practice questions

Practise exhibit-style questions that ask you to read a topology, table, command output or diagram before choosing the best answer.

Quick answer

Exhibit-style questions test whether you can read a topology, command output, diagram or table before choosing the best answer.

How to extract the relevant detail from an exhibit.

How topology, command output or routing information affects the answer.

How to avoid answering from memory before reading the evidence.

How to map the exhibit back to the exam objective.

Related practice questions

Related 1Z0-829 topic practice pages

Scenario questions usually connect to one or more exam topics. Use these links to review the underlying concepts behind the scenario.

Practice set

Practice scenarios

Question 1mediummultiple choice
Full question →

Refer to the exhibit. The exhibit shows a code snippet. What is the output when the variable day is set to Day.WEDNESDAY?

Exhibit

enum Day { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY }
int numLetters = switch (day) {
    case MONDAY, FRIDAY, SUNDAY -> 6;
    case TUESDAY -> 7;
    default -> { int len = day.name().length(); yield len; }
};
System.out.println(numLetters);
Question 2mediummultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

List<Integer> numbers = Arrays.asList(1,2,3,4,5);
long count = numbers.stream().filter(n -> n%2==0).count();
System.out.println("Count: " + count);
Question 3hardmultiple choice
Full question →

Refer to the exhibit. What is the result?

Exhibit

// File: com/example/Outer.java
public class Outer {
    private int x = 10;
    
    class Inner {
        public void printX() {
            System.out.println(x);
        }
    }
    
    public static void main(String[] args) {
        Outer outer = new Outer();
        Outer.Inner inner = outer.new Inner();
        inner.printX();
    }
}
Question 4mediummultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

import java.util.stream.Collectors;
import java.util.List;

List<String> words = List.of("apple", "banana", "cherry", "date");
String result = words.stream()
    .filter(w -> w.length() > 4)
    .collect(Collectors.joining(", "));
System.out.println(result);
Question 5mediummultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

List<Integer> numbers = List.of(10, 20, 30, 40, 50);
Optional<Integer> result = numbers.stream()
    .filter(n -> n > 100)
    .findFirst();
System.out.println(result.orElse(-1));
Question 6mediummultiple choice
Full question →

What is the result of executing the code in the exhibit?

Exhibit

Refer to the exhibit.

public class ExceptionDemo {
    public static void main(String[] args) {
        try {
            methodA();
        } catch (Exception e) {
            System.out.println("Caught in main: " + e.getClass().getSimpleName());
        }
    }
    static void methodA() throws IOException {
        try {
            throw new IOException();
        } catch (Exception e) {
            throw e;
        }
    }
}
Question 7mediummultiple choice
Full question →

What is the output of the code in the exhibit?

Exhibit

Refer to the exhibit.

Exhibit:
```
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.GERMANY);
double value = 1234.5678;
System.out.println(nf.format(value));
```
Question 8easymultiple choice
Full question →

Refer to the exhibit. The module path is correctly set to include the JAR containing the module. What is the most likely issue?

Exhibit

Error: Could not find or load main class com.example.Main
Question 9hardmultiple choice
Full question →

Refer to the exhibit. What is the most likely cause of this exception?

Exhibit

Error log:
java.io.StreamCorruptedException: invalid stream header: 73657200
Question 10hardmultiple choice
Full question →

Refer to the exhibit. A security policy file is configured as shown. The application in app.jar tries to read a file named "${user.home}/data/db.properties". What is the result?

Exhibit

grant codeBase "file:${user.home}/lib/*" {
    permission java.io.FilePermission "${user.home}/config.ini", "read";
    permission java.io.FilePermission "${user.home}/logs/-", "read,write";
    // Missing permission for data files
};

grant codeBase "file:/app/lib/app.jar" {
    permission java.security.AllPermission;
};
Question 11easymultiple choice
Full question →

Given the code in the exhibit, which of the following is true about this custom exception?

Exhibit

Refer to the exhibit.

public class CustomException extends RuntimeException {
    public CustomException(String message) {
        super(message);
    }
}

Usage:
throw new CustomException("Error");
Question 12mediummultiple choice
Full question →

Refer to the exhibit. Which concept does this error relate to?

Exhibit

Error: java.time.format.DateTimeParseException: Text '2024-06-30T23:59:60' could not be parsed: Invalid value for SecondOfMinute (valid values 0 - 59): 60
Question 13easymultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

Boolean b1 = Boolean.valueOf("true");
Boolean b2 = Boolean.valueOf("True");
System.out.println(b1 == b2);
Question 14mediummultiple choice
Full question →

Refer to the exhibit. What is the output?

```java

import java.util.stream.IntStream;

public class Example {
    public static void main(String[] args) {
        int sum = IntStream.rangeClosed(0, 5)

.filter(i -> i >= 0) .sum(); System.out.println(sum);

}
}

```

Exhibit

List<Integer> numbers = List.of(1, 2, 3, 4, 5);
int sum = numbers.stream()
                 .reduce(0, (a, b) -> a + b);
System.out.println(sum);
Question 15hardmultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "David");
Map<Integer, List<String>> grouped = names.stream()
    .collect(Collectors.groupingBy(String::length));
System.out.println(grouped);

These 1Z0-829 practice questions are part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style 1Z0-829 questions with detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics.