Courseiva
Exception Handling and Development ToolsmediumMultiple ChoiceObjective-mapped

1Z0-811 Stack Trace Practice Question

Exhibit

Refer to the exhibit.

```
Exception in thread "main" java.lang.NullPointerException
    at com.example.MyClass.process(MyClass.java:25)
    at com.example.Main.main(Main.java:10)
```

Given 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)

⚠ Common exam trap

Candidates often misread the stack trace by focusing on the exception message or the first line of the trace, which lists the exception type, rather than the actual line number in the class file. The trap is to pick a line from a caller method instead of the line where the exception was thrown, which is the topmost reference to MyClass.java.

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

Line 25

The stack trace displayed in the question shows the exception was thrown at line 25 of MyClass.java. The topmost line in a stack trace indicates the exact line where the exception originated. Lines 10, 15, and 30 correspond to caller methods that appear lower in the stack trace, making line 25 the correct answer.

Answer analysis

Option-by-option breakdown

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

  • Line 30

    Why it's wrong here

    Not mentioned in the stack trace.

  • Line 10

    Why it's wrong here

    Line 10 is in Main.java, not the source of the exception.

  • Line 15

    Why it's wrong here

    Not mentioned in the stack trace.

  • Line 25

    Why this is correct

    The stack trace indicates the exception at line 25 of MyClass.java.

About these practice questions

One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.