Sample questions
Oracle Java Foundations 1Z0-811 practice questions
A company is developing a security-sensitive banking application. Which Java feature most directly enhances security?
In the Java memory model, where are primitive local variables declared inside a method stored?
A team decides to use a single Java source file for a small application. Which statement is true about the file structure?
A method has parameters: int x, double y. It performs x += y; and returns x. What is the range behavior?
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…
A developer needs to concatenate several string values in a loop. Which approach is most efficient for performance?
Which command is used to run a Java application from the command line?
Which loop construct guarantees that the body executes at least once?
A method is declared as: public void setAge(int age) { this.age = age; } Which statement is correct about this code assuming the class has an instance variable age?
Which tool is used to generate documentation comments from Java source code?
Which of the following is not a valid array variable declaration in Java?
Which TWO of the following are legal ways to declare and initialize an array?
Which THREE statements are true about the Java logging API (java.util.logging)?
A developer writes the following code: if (score >= 90) { grade = 'A'; } else if (score >= 80) { grade = 'B'; } else if (score >= 70) { grade = 'C'; } else { grade = 'D'; } What is…
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…
A banking application uses a method to calculate interest: double calculateInterest(double balance) { return balance * 0.05; }. The method is called with an int argument: int accou…
Which TWO are valid Java identifiers? (Choose two.)
What is the output of: System.out.println(new Manager("Alice", 5).getName());
Given: double d = 5.0; int i = d; What is the result?
What is the scope of a variable declared inside a for loop?
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 ti…
Which TWO statements about constructors are true? (Choose two.)
Which three statements about arrays are correct? (Choose three.)
Which command compiles a Java file and generates a .class file?