Courseiva
Exception Handling and Development ToolsmediumMultiple ChoiceObjective-mapped

1Z0-811 Exception Handling and Development Tools Practice Question

Exhibit

Exception in thread "main" java.io.FileNotFoundException: /data/config.txt (Permission denied)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at com.example.ConfigLoader.load(ConfigLoader.java:35)
        at com.example.Main.main(Main.java:12)

Refer to the exhibit. Which action would best resolve this error without changing the code?

⚠ Common exam trap

The 1Z0-811 exam often tests the distinction between handling an exception (try-catch) and resolving its root cause (e.g., permissions), leading candidates to choose the try-catch option even though it does not fix the underlying issue.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Grant read permission on the file.

The error is a FileNotFoundException, which occurs when the file does not exist or cannot be opened. Since the code is correct and the file path is valid, the most likely cause is insufficient permissions. Granting read permission on the file resolves the issue without modifying the code, as it allows the JVM to access the file for reading.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Compile with -Xlint to get more details.

    Why it's wrong here

    -Xlint adds warnings but does not fix runtime errors.

  • Change the file path to a directory that exists.

    Why it's wrong here

    The file path exists; the issue is permissions, not existence.

  • Use a try-catch to handle FileNotFoundException.

    Why it's wrong here

    Handling the exception does not resolve the underlying permission problem.

  • Grant read permission on the file.

    Why this is correct

    The error message explicitly says 'Permission denied', so adjusting permissions fixes the issue.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

Courseiva writes every 1Z0-811 question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.