1Z0-811 · domain
Exception Handling and Development Tools
Practise Oracle Java Foundations 1Z0-811 Exception Handling and Development Tools practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.
Focused practice
Practice Exception Handling and Development Tools questions
Scored sessions drawing only from this domain — pick a length below.
Start 20-question practice test →What this domain covers
What to know about Exception Handling and Development Tools
Exception Handling and Development Tools 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.
Watch out for
Common Exception Handling and Development Tools exam traps
- ▸Answering from memory before reading the full scenario.
- ▸Missing a constraint such as cost, availability, security, scope or command context.
- ▸Choosing a broad answer when the question asks for the most specific fix.
- ▸Ignoring why the wrong options are tempting.
Question index
All Exception Handling and Development Tools questions (59)
Click any question to see the full explanation, or start a practice session above.
A method declares throws FileNotFoundException and SQLException. Which statement about the caller is true?
Hard2A developer is using the Oracle Java Platform Debugger Architecture (JPDA) to debug a remote Java application. Which command-line option is required to start the application in debug mode listening on port 5005?
Medium3A Java application uses a custom exception class that extends Exception. The application throws this exception from a method, but the method does not declare it in its throws clause. Which statement is true?
Hard4Which tool is used to generate documentation comments from Java source code?
Easy5Which statement about the Java compiler is true?
Easy6Given the stack trace above, which line in MyClass.java caused the exception? Exception in thread "main" java.lang.NullPointerException at MyClass.methodC(MyClass.java:25) at MyClass.methodB(MyClass.java:15) at MyClass.methodA(MyClass.java:10) at MyClass.main(MyClass.java:30)
Medium7A team is using a build tool to compile and package a Java application. They want to automatically run unit tests after compilation and before packaging. Which tool and configuration is most appropriate?
Medium8You are a Java developer at a financial firm. The application processes transactions from a queue. The team recently migrated from Java 8 to Java 11. After the migration, the application intermittently throws an exception: 'java.lang.reflect.InaccessibleObjectException: Unable to make field private final byte[] java.lang.String.value accessible: module java.base does not 'opens java.lang' to unnamed module'. This error occurs when the application tries to use reflection to access private fields of String objects for serialization. The application runs on a server where you cannot modify the JVM startup scripts. However, you can modify the application code and the module-info.java file. You need to resolve the exception without breaking existing functionality. Which approach should you take?
Hard9A developer encounters a ClassNotFoundException at runtime. The class is present in the source code and compiles fine. Which is the most likely cause?
Easy10What is the output if an ArithmeticException occurs in the try block and there is a finally block?
Medium11A developer writes a method that reads a file and parses its contents. Which exception handling approach is best practice for ensuring the file is properly closed even if an exception occurs?
Easy12You are maintaining a multi-threaded banking application that processes transactions. In the `processTransaction` method, you have a try-catch block that catches `Exception` to handle any unexpected errors. Recently, the application intermittently fails to update account balances correctly due to unhandled exceptions. The logs show that sometimes a `RuntimeException` is thrown from a nested method, but it is not being logged or handled properly, leading to inconsistent state. The team wants to improve the exception handling to ensure that all exceptions are caught, logged, and the transaction is rolled back properly. The method currently uses a primitive try-catch-finally where the finally block commits the transaction if no exception occurred. Which approach best addresses the issue while maintaining clarity and correctness?
Medium13Refer to the exhibit. A Java source file fails to compile with the given error. What change should be made to fix the error?
Hard14Consider the following code snippet: public int getValue() { try { return 1; } catch (Exception e) { return 2; } finally { return 3; } } What does the method return?
Medium15Which THREE statements about custom exceptions in Java are correct? (Select exactly 3)
Hard16Which THREE of the following are checked exceptions in Java?
Easy17Which TWO statements about the finally block are true? (Choose two.)
Medium18Which TWO of the following development tools are specifically designed to analyze module dependencies or create custom runtime images?
Hard19A method throws a checked exception. Which of the following is the correct way to handle it in the calling method?
Medium20Which command compiles a Java file and generates a .class file?
Easy21What does the java command with -jar option do?
Easy22Consider the following code: ```java import java.io.*; public class Test { public static void main(String[] args) throws IOException { try (FileInputStream fis = new FileInputStream("test.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(fis))) { System.out.println(br.readLine()); } catch (IOException e) { System.out.println("Error"); } } } ``` Which statement about this code is true?
Hard23A developer writes a method that reads a file and must ensure the file is closed even if an exception occurs. Which construct should be used?
Medium24A developer writes a method that reads a file and processes its contents. If the file does not exist, the method should notify the caller. Which exception should the method declare in its throws clause?
Medium25Which THREE statements are true about the Java logging API (java.util.logging)?
Hard26A developer is debugging a Java application that throws a NullPointerException. Which two actions help identify the source of the exception? (Choose two.)
Medium27You are responsible for deploying a Java desktop application that uses JavaFX and various third-party libraries. The application is modular and uses JPMS. To reduce the footprint and startup time, you decide to use jlink to create a custom runtime image that includes only the required modules. The application has a main module `com.myapp` that requires `javafx.controls`, `javafx.base`, and some other modules. After creating the runtime image using the command `jlink --module-path $JAVA_HOME/jmods:lib --add-modules com.myapp --output myapp-image`, you test the image on a development machine, and it works. However, when deploying to a customer's machine, the application fails to start with an error: "Error: Could not find or load main class com.myapp.Main". The customer's machine has no Java installed. The runtime image includes the `com.myapp` module. You verify that the `myapp-image/bin/java` launcher exists. The main class is correctly declared in the module-info.java of `com.myapp`. What is the most likely cause of this error?
Medium28Which TWO are valid ways to handle a checked exception in a method?
Medium29A 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?
Medium30A developer is using try-with-resources with a custom resource class that implements AutoCloseable. The class's close() method throws a custom exception `ResourceException`. In the try block, an IOException occurs. Which of the following best describes the exception that is propagated to the caller?
Hard31A team is designing a library that handles network timeouts. They create a custom exception `NetworkTimeoutException` that extends `Exception`. They want to ensure that callers are forced to handle this exception. Which declaration is appropriate for a method that throws this exception?
Hard32Which of the following exceptions is a checked exception?
Easy33Which THREE are checked exceptions in Java? (Choose three.)
Hard34Given the compilation error above, which fix would resolve the error?
Hard35Which TWO command-line tools are included in the Oracle JDK for monitoring and troubleshooting Java applications? (Select exactly 2)
Medium36A custom exception class must extend which class to be a checked exception?
Hard37Which TWO of the following are best practices for exception handling in Java?
Medium38When using try-with-resources, which interface must the resource implement?
Medium39Refer to the exhibit. Which action would best resolve this error without changing the code?
Medium40Arrange the steps to use a for loop to iterate over an array in Java in the correct order.
Medium41Which TWO statements are true about the finally block in exception handling? (Select exactly 2)
Medium42Refer 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?
Hard43A developer writes a method that reads a file and processes its contents. The method uses a BufferedReader wrapped around a FileReader. Which of the following approaches ensures that both resources are properly closed even if an exception occurs?
Medium44Given a method that catches Exception and then throws a RuntimeException, what is the effect?
Hard45Match each Java keyword to its use.
Medium46Given the following try-catch block: try { // some code } catch (IOException | NumberFormatException e) { e = new IOException("wrapper"); // throw e; } Which line causes a compilation error?
Hard47Which of the following is the best practice for resource management in Java?
Easy48You are a junior developer tasked with generating API documentation for a large Java project. The project uses Javadoc comments extensively, and you need to generate HTML documentation that includes all public and protected classes and methods. You have access to the source files in the `src` directory, and you want the output to be placed in a `docs` folder. Additionally, you want to include a custom header and footer in each generated page. The project uses multiple packages like `com.example.app`, `com.example.util`, and `com.example.data`. You plan to run the javadoc command from the project root. Which command should you use?
Easy49Which command is used to run a Java application from the command line?
Easy50Consider a Java application that throws a NullPointerException deep inside a library method. The stack trace does not include the caller's line numbers because the library was compiled without debug information. Which approach would best help identify the root cause?
Hard51A developer is maintaining a Java backend service for order processing. The service uses a third-party library that throws a checked PaymentException when a payment fails. The current processOrder method catches Exception generically, logs the error, and returns null. The business requires that when a payment fails, the order status must be updated to 'FAILED' in the database, and a notification must be sent to the customer. However, due to the generic catch, these actions are not performed. The developer must modify the code to meet the business requirements without changing the external API of the class (i.e., the method signature must remain the same and must not throw any exceptions to the caller). Which course of action should the developer take?
Easy52A developer needs to handle a specific checked exception, FileNotFoundException, but also wants to catch any other IOException that might occur. Which catch block ordering is correct?
Easy53Refer to the exhibit. A Java program throws a NullPointerException. Which is the most likely cause?
Medium54A developer compiles a Java application using the command `javac -d bin src/com/example/App.java`. Which of the following is true?
Easy55A developer encounters an ArrayIndexOutOfBoundsException while running a unit test. The stack trace shows the error occurs in a method that is called from many places. Which tool or technique would most efficiently identify the specific call path?
Hard56A developer writes a catch block that handles multiple exception types that have a subclass relationship. Which of the following is a valid use of the multi-catch feature?
Easy57A 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?
Hard58Which TWO are benefits of using try-with-resources?
Medium59Refer to the exhibit. Which statement is true about the InvalidInputException class?
EasyOther domains
All 1Z0-811 exam domains
Frequently asked questions
- What does the Exception Handling and Development Tools domain cover on the 1Z0-811 exam?
- Exception Handling and Development Tools questions test whether you can apply the concept in context, not just recognise a definition.
- How many questions are in this domain?
- This page lists all 59 Exception Handling and Development Tools questions in the 1Z0-811 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
- What is the best way to practise this domain?
- Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
- Can I practise only Exception Handling and Development Tools questions?
- Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.