DADT03 Exception Handling

DADT03 Exception Handling

Assessment

Quiz

Information Technology (IT)

Professional Development

Medium

Created by

Izzati Safwanah

Used 1+ times

FREE Resource

Student preview

quiz-placeholder

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main purpose of exception handling in Java?

To ignore runtime errors

To terminate the program immediately

To handle runtime errors gracefully

To increase program performance

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a checked exception?

NullPointerException

IOException

ArithmeticException

ArrayIndexOutOfBoundsException

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the top-most class in the exception hierarchy in Java?

RuntimeException

Error

Exception

Throwable

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to handle exceptions in Java?

throw

catch

try

finally

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to explicitly raise an exception?

raise

throws

throw

error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method must be overridden when creating a custom exception class?

getCause()

toString()

getMessage()

None (optional override)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In a try-with-resources statement, which interface must the resource implement?

AutoCloseable

Serializable

Runnable

CloseableOnly

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?