20+ practice questions focused on Handling Exceptions — one of the most tested topics on the Oracle Certified Professional Java SE 17 Developer 1Z0-829 exam. Each question includes a detailed explanation so you learn why the right answer is correct.
Start Handling Exceptions PracticeA developer is writing a method that reads a file and processes its content. The method must ensure that if an IOException occurs during reading, the method throws a custom ApplicationException that wraps the original IOException, and that any resources opened are closed properly. Which approach correctly implements this requirement?
Explanation: Option C is correct because it uses a try-with-resources statement, which automatically closes the BufferedReader (which implements AutoCloseable) when the block exits, whether normally or exceptionally. The catch clause then catches any IOException and wraps it in a custom ApplicationException, satisfying both the resource-closing and exception-wrapping requirements without manual cleanup.
A team is designing a logging framework. The framework's core method log(String message) may throw a checked LogException if the logging system fails. The team wants to allow callers to choose whether to handle the exception or declare it as thrown. Which declaration of the log method satisfies this requirement?
Explanation: Option A is correct because it declares the checked exception LogException in the throws clause, which forces callers to either handle it with a try-catch or propagate it by declaring throws in their own method. This satisfies the requirement that callers can choose how to deal with the exception, as checked exceptions must be acknowledged at compile time.
Which TWO statements about the try-with-resources statement are correct? (Choose two.)
Explanation: Option A is correct because the try-with-resources statement requires that each resource implements the AutoCloseable interface (or its subinterface Closeable). This interface defines the close() method, which is automatically invoked by the JVM when the try block completes, ensuring proper resource management without explicit finally blocks.
What is the result when the main method is executed?
Explanation: The correct answer is C because the code demonstrates that when an exception is thrown in a try block, the corresponding catch block for that exception type is executed, and then the finally block runs. After the finally block completes, the program terminates normally. In this case, the try block throws an ArithmeticException, which is caught by the catch block that prints 'C', and then the finally block executes but does not change the output.
You are responsible for a Java 17 application that processes user uploads. The application uses a custom AutoCloseable resource, UploadSession, which must always be closed after use to free server resources. A junior developer wrote the following code: ``` UploadSession session = new UploadSession(); try { session.upload(data); // more processing } catch (UploadException e) { log.error("Upload failed", e); } finally { session.close(); } ``` During a code review, you notice that the close() method of UploadSession throws a checked CloseException. The current code does not handle this exception. Which course of action should you recommend to ensure the application is robust and follows best practices?
Explanation: Option D is correct because try-with-resources automatically calls the close() method on the UploadSession resource when the try block exits, whether normally or abruptly. This eliminates the need for an explicit finally block and ensures that any checked exception thrown by close() is either caught or propagated according to the developer's declared exception handling, making the code both robust and concise.
+15 more Handling Exceptions questions available
Practice all Handling Exceptions questions1. Baseline your knowledge
Start with 10 questions to gauge your current understanding of Handling Exceptions. This tells you whether you need a concept refresher or just practice.
2. Review every explanation
For each question — right or wrong — read the full explanation. Understanding why an answer is correct is more valuable than knowing the answer itself.
3. Focus on exam traps
Handling Exceptions questions on the 1Z0-829 frequently use trap wording. Look for subtle differences in answers that test your precision, not just general knowledge.
4. Reach 80% consistently
Do repeated sessions until you score 80%+ three times in a row. Then move to mixed-mode practice to test cross-topic recall under realistic conditions.
The exact number varies per candidate. Handling Exceptions is tested as part of the Oracle Certified Professional Java SE 17 Developer 1Z0-829 blueprint. Practicing with targeted Handling Exceptions questions ensures you can handle any format or difficulty that appears.
Yes. Courseiva provides free 1Z0-829 practice questions across all exam topics and domains. The platform includes topic-based practice, mock exams, missed-question review, bookmarked questions, and readiness tracking — no account required.
Difficulty is subjective, but Handling Exceptions is a high-priority exam concept tested in multiple ways — direct recall, scenario analysis, and command-output interpretation. Consistent practice is the best way to build confidence.
Launch a full Handling Exceptions practice session with instant scoring and detailed explanations.
Start Handling Exceptions Practice →