Back to Oracle Java Foundations 1Z0-811 questions

Scenario-based practice

Hard Difficulty 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.

18
scenario questions
1Z0-811
exam code
Oracle
vendor

Scenario guide

How to approach hard difficulty questions

These are the questions most candidates get wrong. They require connecting multiple concepts, reading tricky output, or knowing edge-case behaviour that isn't on most study cards. Practising them trains you to operate under uncertainty — a necessary skill on the real exam.

Quick answer

Hard Difficulty Questions questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider 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 1hardmultiple choice
Full question →

Given: int a = 10; int b = 20; boolean flag = a++ > 10 && ++b > 20; What are the values of a and b after execution?

Question 2hardmultiple choice
Full question →

A developer writes: for(int i=0; i<10; i++) { if(i%2==0) continue; System.out.print(i); }. What is the output?

Question 3hardmulti select
Full question →

Which TWO statements are true about interfaces in Java?

Question 4hardmultiple choice
Full question →

Given: abstract class Shape { abstract void draw(); } class Circle extends Shape { void draw() {} } Which is true?

Question 5hardmultiple choice
Full question →

What is the value of y?

Exhibit

Refer to the exhibit.

public class Test {
    public static void main(String[] args) {
        int x = 10;
        int y = x++ + ++x;
        System.out.println(y);
    }
}
Question 6hardmultiple choice
Full question →

Given the code: int[] arr = {1,2,3}; for(int x : arr) { if(x==2) continue; System.out.print(x); } What is the output?

Question 7hardmulti select
Full question →

Which THREE statements are true about the break and continue statements in Java? (Choose three.)

Question 8hardmultiple choice
Full question →

Given: boolean a = false; boolean b = true; boolean c = true; System.out.println(a || b && c); What is the output?

Question 9hardmultiple choice
Full question →

Given: String str = "Java"; str = str.concat(" SE"); str.replace('a', 'A'); System.out.println(str); What is the output?

Question 10hardmultiple choice
Full question →

What is the value of sum printed?

Exhibit

Refer to the exhibit.

int sum = 0;
for (int i = 1; i <= 10; i++) {
    if (i % 3 == 0) {
        break;
    }
    sum += i;
}
System.out.println(sum);
Question 11hardmultiple choice
Full question →

Which of the following correctly describes the effect of the method call 'Arrays.sort(myArray)' on an array of objects that do not implement Comparable?

Question 12hardmultiple choice
Full question →

A class 'Base' has a method 'public void display() throws IOException'. Subclass 'Derived' overrides display(). Which exception specifications are allowed in the overriding method?

Question 13hardmultiple choice
Full question →

Given the compilation error above, which fix would resolve the error?

Exhibit

Refer to the exhibit.

```
$ javac MyApp.java
MyApp.java:5: error: unreported exception FileNotFoundException; must be caught or declared to be thrown
        FileReader fr = new FileReader("file.txt");
                        ^
1 error
```
Question 14hardmulti select
Full question →

Which THREE are checked exceptions in Java? (Choose three.)

Question 15hardmultiple choice
Read the full NAT/PAT explanation →

A team is developing a Java application that uses many third-party libraries. One library throws a checked exception that is not declared in its method signature. Which approach best handles this situation?

Question 16hardmultiple choice
Full question →

A method is declared as: public static int[] generateSequence(int n) { ... }. Which return statement is valid inside this method?

Question 17hardmultiple choice
Full question →

A programmer writes code to transpose a 2D array (matrix). Given: int[][] matrix = {{1,2},{3,4}}; int[][] result = new int[2][2]; for (int i=0; i<2; i++) for (int j=0; j<2; j++) result[j][i] = matrix[i][j]; What is the value of result[1][0]?

Question 18hardmultiple choice
Full question →

Which approach does NOT create a new array that is independent of the original?

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.