Courseiva
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.

20
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 →

In the Java memory model, where are primitive local variables declared inside a method stored?

Question 2hardmultiple choice
Full question →

A method has parameters: int x, double y. It performs x += y; and returns x. What is the range behavior?

Question 3hardmultiple choice
Full question →

You are part of a team maintaining a legacy order processing system. The system stores order totals as primitive double values. A recent bug report shows that for very large orders (around $1,000,000.00), the total after adding a tax of 8.25% is sometimes off by a few cents. The calculation is: total = orderTotal * (1 + taxRate). The taxRate is defined as double taxRate = 0.0825; The orderTotal is received as a double. The application needs exact monetary precision to two decimal places. Which solution best addresses the precision issue while minimizing changes to the existing code?

Question 4hardmulti select
Full question →

Which THREE statements are true about the Java logging API (java.util.logging)?

Question 5hardmultiple choice
Full question →

You are tuning a real-time data processing application that reads sensor data from a queue. The system must process each sensor reading, but occasionally a reading is invalid (null) and should be skipped. The loop must run indefinitely until the application is shut down gracefully. The current implementation uses a while(true) loop with a break condition when a shutdown flag is set. However, the loop is consuming excessive CPU because it continuously polls the queue even when no data is available. You need to modify the loop to reduce CPU usage while still processing data efficiently. Which approach should you take?

Question 6hardmultiple choice
Full question →

Given: double d = 5.0; int i = d; What is the result?

Question 7hardmultiple choice
Full question →

A developer is working on a Java program that processes sensor data. The data is stored in a 2D array 'double[][] readings', where each row represents a sensor and each column a time interval. The method 'public static double[] averagePerSensor(double[][] data)' should compute the average reading for each sensor (row) and return a 1D array of averages. The developer writes the following implementation: 'double[] result = new double[data.length]; for (int i = 0; i < data.length; i++) { double sum = 0; for (int j = 0; j < data[i].length; j++) { sum += data[i][j]; } result[i] = sum / data[i].length; } return result;'. However, the program sometimes throws a NullPointerException. What is the most likely cause?

Question 8hardmultiple choice
Full question →

A team is designing a new system that requires deploying independent services communicating over a network. Which Java technology is most suitable for this architecture?

Question 9hardmultiple choice
Full question →

Which of the following best demonstrates polymorphism in Java?

Question 10hardmultiple choice
Full question →

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

Question 11hardmulti select
Full question →

Which three of the following are valid ways to declare and initialize a variable of type int? (Choose three.)

Question 12hardmulti select
Full question →

Which THREE statements are true about passing arrays to methods in Java?

Question 13hardmulti select
Full question →

Which THREE are valid ways to declare and initialize an integer variable in Java? (Choose three.)

Question 14hardmultiple choice
Full question →

A Java class named 'Helper' is defined in package 'utils'. Another class in a different package tries to access a public method of Helper but receives a compilation error. The Helper class is declared as 'class Helper' (without public modifier). What is the likely issue?

Question 15hardmultiple choice
Full question →

A developer uses a switch statement with a String variable. Which is true about this usage?

Question 16hardmultiple choice
Full question →

A developer is writing a bitmask validation method. The method should return true if both input integers (x and y) have exactly the same least significant bit set. The developer writes: if (x & y == 1) { return true; } However, the condition never evaluates to true even when both numbers are odd (least significant bit = 1). Debugging shows that x and y are positive integers. What is the root cause and the correct fix?

Question 17hardmulti select
Full question →

Which THREE of the following are primitive data types in Java?

Question 18hardmulti select
Full question →

Which three statements about String immutability are true? (Choose three)

Question 19hardmultiple choice
Full question →

A method 'public static void modify(int[][] matrix) { matrix[0][0] = 99; }' is called with 'int[][] values = {{1,2},{3,4}}; modify(values);'. What is the value of values[0][0] after the call?

Question 20hardmulti select
Full question →

Which THREE of the following are primitive data types in Java?

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.