Courseiva
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 1easymultiple choice
Full question →

Refer to the exhibit.

What is the likely cause?

Exhibit

javac Test.java
Test.java:5: error: cannot find symbol
    System.out.println(value);
                        ^
  symbol:   variable value
  location: class Test
Question 2easymultiple choice
Full question →

Refer to the exhibit. Which statement is true about the InvalidInputException class?

Exhibit

public class InvalidInputException extends Exception {
    public InvalidInputException(String message) {
        super(message);
    }
}
Question 3hardmultiple choice
Full question →

Refer to the exhibit. A Java source file fails to compile with the given error. What change should be made to fix the error?

Exhibit

error: unreported exception java.io.IOException; must be caught or declared to be thrown
    br.readLine();
              ^
Question 4mediummultiple 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 5easymultiple choice
Full question →

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

Exhibit

javac Test.java
Test.java:3: error: variable x might not have been initialized
        System.out.println(x);
                        ^
Question 6mediummultiple choice
Full question →

Refer to the exhibit. Which overloaded methods cause this compilation error?

Exhibit

javac Test.java
Test.java:5: error: reference to print is ambiguous
        print(null);
        ^
  both method print(String[]) in Test and method print(String...) in Test match
Question 7mediummultiple choice
Full question →

A developer tries to compile a modular Java application using the command shown in the exhibit. The compilation fails with the error shown. What is the most likely cause?

Network Topology
$ javac -d outmodule-source-path src -m com.example.appRefer to the exhibit.src/com.example.app/com/example/app/Main.java:5: error: cannot find symbolimport com.example.util.Helpersymbol: class Helperlocation: package com.example.util1 error
Question 8hardmultiple 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 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 output?

Exhibit

class Animal {
    public void sound() {
        System.out.println("Animal sound");
    }
}
class Dog extends Animal {
    public void sound() {
        System.out.println("Bark");
    }
    public void fetch() {
        System.out.println("Fetching");
    }
}
public class Test {
    public static void main(String[] args) {
        Animal a = new Dog();
        a.sound();
        ((Dog) a).fetch();
    }
}
Question 11easymultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

public class Test {
    public void print(int i) { System.out.println("int"); }
    public void print(double d) { System.out.println("double"); }
    public static void main(String[] args) {
        Test t = new Test();
        t.print(10);
    }
}
Question 12hardmultiple 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)
Question 13hardmultiple choice
Full question →

Refer to the exhibit. What is the result?

Exhibit

int x = 5;
int y = 0;
int z = x / y;
System.out.println(z);
Question 14easymultiple choice
Full question →

Refer to the exhibit. What is the output?

Exhibit

public class Example {
    public static void main(String[] args) {
        int[] nums = {1, 2, 3};
        int[] result = process(nums);
        System.out.println(result[0]);
    }
    public static int[] process(int[] input) {
        int[] output = new int[input.length];
        for (int i = 0; i < input.length; i++) {
            output[i] = input[i] * 2;
        }
        return output;
    }
}
Question 15mediummultiple 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);
    }
}

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.