Practice 1Z0-811 Exception Handling and Development Tools questions with full explanations on every answer.
Start practicing
Exception Handling and Development Tools — choose a session length
Free · No account required
Click any question to see the full explanation and answer options, or start a focused practice session above.
A 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?
2A 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?
3Which of the following is the best practice for resource management in Java?
4A 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?
5Which statement about the Java compiler is true?
6A method throws a checked exception. Which of the following is the correct way to handle it in the calling method?
7Which command is used to run a Java application from the command line?
8Which TWO statements about the finally block are true? (Choose two.)
9Which THREE are checked exceptions in Java? (Choose three.)
10Given the stack trace above, which line in MyClass.java caused the exception?
11Given the compilation error above, which fix would resolve the error?
12You 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?
13Arrange the steps to use a for loop to iterate over an array in Java in the correct order.
14Match each Java keyword to its use.
15A 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?
16Which of the following exceptions is a checked exception?
17A method declares throws FileNotFoundException and SQLException. Which statement about the caller is true?
18What is the output if an ArithmeticException occurs in the try block and there is a finally block?
19Which command compiles a Java file and generates a .class file?
20A custom exception class must extend which class to be a checked exception?
21When using try-with-resources, which interface must the resource implement?
22What does the java command with -jar option do?
23Given a method that catches Exception and then throws a RuntimeException, what is the effect?
24Which TWO are benefits of using try-with-resources?
25Which TWO are valid ways to handle a checked exception in a method?
26Which THREE statements are true about the Java logging API (java.util.logging)?
27Refer to the exhibit. A Java program throws a NullPointerException. Which is the most likely cause?
28Refer to the exhibit. A Java source file fails to compile with the given error. What change should be made to fix the error?
29Refer to the exhibit. Which statement is true about the InvalidInputException class?
30A 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?
31A 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?
32Consider 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?
33A 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?
34A 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?
35A 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?
36Which tool is used to generate documentation comments from Java source code?
37A developer encounters a ClassNotFoundException at runtime. The class is present in the source code and compiles fine. Which is the most likely cause?
38Given the following try-catch block: try { // some code } catch (IOException | NumberFormatException e) { e = new IOException("wrapper"); // throw e; } Which line causes a compilation error?
39Which TWO statements are true about the finally block in exception handling? (Select exactly 2)
40Which TWO command-line tools are included in the Oracle JDK for monitoring and troubleshooting Java applications? (Select exactly 2)
41Which THREE statements about custom exceptions in Java are correct? (Select exactly 3)
42Refer to the exhibit. Which action would best resolve this error without changing the code?
43Refer to the exhibit. What does this warning indicate?
44Refer to the exhibit. Which statement about this code is true?
45A 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?
46A 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?
47A 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?
48Consider the following code snippet: public int getValue() { try { return 1; } catch (Exception e) { return 2; } finally { return 3; } } What does the method return?
49A 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?
50A developer compiles a Java application using the command `javac -d bin src/com/example/App.java`. Which of the following is true?
51Which TWO of the following are best practices for exception handling in Java?
52Which TWO of the following development tools are specifically designed to analyze module dependencies or create custom runtime images?
53Which THREE of the following are checked exceptions in Java?
54A 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?
55You are a Java developer working on an enterprise application that uses a modular architecture with Java Platform Module System (JPMS). The application consists of several modules: `com.app.core`, `com.app.util`, `com.app.service`, and `com.app.client`. The application runs on a server that has Java 17 installed. Recently, the operations team reported that after a deployment, the application fails to start with a `NoClassDefFoundError` for a class in `com.app.util`, even though the class exists in the compiled module. The deployment process uses a custom script that compiles the modules using `javac` with `--module-source-path`, then uses `jlink` to create a custom runtime image that includes only the required modules. The runtime image is then deployed to the server. The build logs show no errors during compilation or linking. However, on the server, the error occurs. The server has multiple versions of the same library on the classpath due to legacy scripts. You suspect that the error is due to a module resolution issue. Which corrective action should you take?
56You 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?
57You 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?
58You 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?
59A developer is debugging a Java application that throws a NullPointerException. Which two actions help identify the source of the exception? (Choose two.)
60Refer 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?
61A 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?
The Exception Handling and Development Tools domain covers the key concepts tested in this area of the 1Z0-811 exam blueprint published by Oracle. Courseiva provides free domain-focused practice, mock exams, missed-question review, and readiness tracking across all 1Z0-811 domains — no account required.
The Courseiva 1Z0-811 question bank contains 61 questions in the Exception Handling and Development Tools domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Exception Handling and Development Tools domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included