nerdexam
Oracle

1Z0-803 · Question #267

Which two statements correctly describe checked exception?

The correct answer is A. These are exceptional conditions that a well-written application should anticipate and recover E. Every class that is a subclass of Exception, excluding RuntimeException and its subclasses,. This question evaluates understanding of checked exceptions in Java, covering their purpose and formal classification within the exception hierarchy.

Handling Exceptions

Question

Which two statements correctly describe checked exception?

Options

  • AThese are exceptional conditions that a well-written application should anticipate and recover
  • BThese are exceptional conditions that are external to the application, and that the application
  • CThese are exceptional conditions that are internal to the application, and that the application
  • DEvery class that is a subclass of RuntimeException and Error is categorized as checked
  • EEvery class that is a subclass of Exception, excluding RuntimeException and its subclasses,

How the community answered

(55 responses)
  • A
    91% (50)
  • B
    2% (1)
  • C
    5% (3)
  • D
    2% (1)

Why each option

This question evaluates understanding of checked exceptions in Java, covering their purpose and formal classification within the exception hierarchy.

AThese are exceptional conditions that a well-written application should anticipate and recoverCorrect

Checked exceptions represent exceptional conditions that are typically recoverable and that a robust application should foresee and handle programmatically, such as file I/O errors or network issues.

BThese are exceptional conditions that are external to the application, and that the application

This statement is incomplete and too broad; exceptional conditions, whether external or internal, can manifest as either checked or unchecked exceptions depending on their recoverability and type.

CThese are exceptional conditions that are internal to the application, and that the application

This statement is incomplete and too broad; exceptional conditions, whether external or internal, can manifest as either checked or unchecked exceptions depending on their recoverability and type.

DEvery class that is a subclass of RuntimeException and Error is categorized as checked

Classes that are subclasses of `RuntimeException` and `Error` are categorized as unchecked exceptions, meaning the Java compiler does not enforce their handling or declaration.

EEvery class that is a subclass of Exception, excluding RuntimeException and its subclasses,Correct

In Java, checked exceptions are formally defined as any class that is a subclass of `java.lang.Exception`, with the specific exclusion of `java.lang.RuntimeException` and all its subclasses.

Concept tested: Java checked exception definition and characteristics

Source: https://docs.oracle.com/javase/tutorial/essential/exceptions/definition.html

Topics

#Checked exceptions#Exception hierarchy#Exception types

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice