Back to Oracle Java Foundations 1Z0-811 questions

Scenario-based practice

Refer to the Exhibit Practice Questions

Practise Oracle Java Foundations 1Z0-811 practice questions — original exam-style scenarios covering every exam domain, with detailed explanations, wrong-answer analysis, and common exam traps.

15
scenario questions
1Z0-811
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-811 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 →

A developer runs the command shown in the exhibit. The developer wants to ensure the application uses the latest available language features. Which action should the developer take?

Exhibit

Refer to the exhibit.
```
$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
```
Question 2hardmultiple choice
Full question →

Refer to the exhibit. The code at line 6 of ArrayExample.java is: int[] arr = {10, 20, 30, 40, 50}; int sum = 0; for (int i = 0; i <= arr.length; i++) sum += arr[i]; Which change fixes the exception?

Exhibit

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 5
    at ArrayExample.main(ArrayExample.java:6)
Question 3mediummultiple choice
Full question →

Refer to the exhibit. Which action would best resolve this error without changing the code?

Exhibit

Exception in thread "main" java.io.FileNotFoundException: /data/config.txt (Permission denied)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at com.example.ConfigLoader.load(ConfigLoader.java:35)
        at com.example.Main.main(Main.java:12)
Question 4hardmultiple choice
Full question →

Refer to the exhibit. Which statement about this code is true?

Exhibit

public class ResourceHandler {
    public void process() throws IOException {
        try (FileInputStream fis = new FileInputStream("data.txt");
             BufferedReader br = new BufferedReader(new InputStreamReader(fis))) {
            // read file
        } catch (IOException e) {
            throw e;
        }
    }
}
Question 5mediummultiple choice
Full question →

Refer to the exhibit. What is the result?

Exhibit

int[] data = {1, 2, 3, 4, 5};
int sum = 0;
for (int i = 0; i <= data.length; i++) {
    sum += data[i];
}
System.out.println(sum);
Question 6hardmultiple choice
Full question →

Refer to the exhibit.

What is the output?

Exhibit

interface Printable {
    void print();
}
class Document implements Printable {
    public void print() { System.out.println("Document"); }
}
class Photo extends Document {
    public void print() { System.out.println("Photo"); }
}
public class Test {
    public static void main(String[] args) {
        Document d = new Photo();
        d.print();
    }
}
Question 7mediummultiple choice
Full question →

Refer to the exhibit. What is the output when the following code is executed? Vehicle v = new Car(); v.accelerate(); System.out.println(v.speed);

Exhibit

public class Vehicle { protected int speed; public Vehicle() { speed = 0; } public void accelerate() { speed += 10; } } public class Car extends Vehicle { public void accelerate() { speed += 20; } }
Question 8mediummultiple choice
Full question →

Refer to the exhibit.

What is the output?

Exhibit

class Vehicle {
    String type = "Vehicle";
}
class Car extends Vehicle {
    String type = "Car";
}
public class Test {
    public static void main(String[] args) {
        Vehicle v = new Car();
        System.out.println(v.type);
    }
}
Question 9easymultiple choice
Full question →

Refer to the exhibit. Why does the code fail to compile?

Exhibit

public class Test { public static void main(String[] args) { Animal a = new Animal(); a.sound(); } } abstract class Animal { abstract void sound(); }
Question 10hardmultiple choice
Full question →

Refer to the exhibit. What is the potential issue with this singleton implementation in a multithreaded environment?

Exhibit

public class Singleton { private static Singleton instance; private Singleton() {} public static Singleton getInstance() { if (instance == null) { instance = new Singleton(); } return instance; } }
Question 11mediummultiple choice
Full question →

Refer to the exhibit. What is the problem with this class?

Exhibit

Consider the following Java class:

public class Employee {
    private String name;
    public Employee(String name) {
        name = name;
    }
    public String getName() {
        return name;
    }
}
Question 12easymultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

public class BooleanCheck {
    public static void main(String[] args) {
        boolean a = true;
        boolean b = false;
        boolean c = a || b && !a;
        System.out.println(c);
    }
}
Question 13easymultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

String str1 = "Java";
String str2 = new String("Java");
System.out.println(str1 == str2);
Question 14mediummultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

public class Test {
    public static void main(String[] args) {
        int a = 3;
        int b = 5;
        int c = a * b + 2;
        System.out.println(c);
    }
}
Question 15hardmultiple choice
Full question →

Refer to the exhibit. A developer encounters this exception when running the application. The method divide is intended to handle division by zero. What is the most likely cause of the exception?

Exhibit

Exception in thread "main" java.lang.ArithmeticException: / by zero
	at com.example.Calculator.divide(Calculator.java:12)
	at com.example.Main.main(Main.java:5)

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