0% found this document useful (0 votes)
36 views

Course:: Easy-To-Follow Java Programming

The document provides a quiz on Java exceptions with 7 multiple choice questions. It tests knowledge of keywords like throw and catch used to create and handle exceptions. It also covers topics like the exception class hierarchy with RuntimeException as a subclass of Exception, and the differences between checked and unchecked exceptions in terms of whether they must be declared or not.

Uploaded by

Fuad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Course:: Easy-To-Follow Java Programming

The document provides a quiz on Java exceptions with 7 multiple choice questions. It tests knowledge of keywords like throw and catch used to create and handle exceptions. It also covers topics like the exception class hierarchy with RuntimeException as a subclass of Exception, and the differences between checked and unchecked exceptions in terms of whether they must be declared or not.

Uploaded by

Fuad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Course: Easy-to-follow Java programming

The quiz questions


Answer the questions below to review what you have learned in Video 14. You will
find the right answers after the questions in the solution part.

1. Exceptions…

… are errors.

… denote exceptional situations that might be errors or something


you should handle.

… are objects in Java.

… are people from the medieval ages.

… are good for separating error handling from the normal algorithm.

2. Which keyword is used to create an exception?

throws

throw

raise

create

catch

try

finally

Duckademy IT courses – www.duckademy.com


3. Which keyword is used to get and handle an exception?

throws

throw

raise

create

catch

try

finally

4. What is the finally keyword for?

To denote that we are fed up with programming and need a holiday

To denote that a method can produce an exception

To denote the exception handling part in the code

To denote a block of code that always run either there is an exception


or not.

5. What are true for the Exception class hierarchy?

Error class is a subclass of Exception.

RuntimeException class is a subclass of Exception.

RuntimeException class is a subclass of NullPointerException.

Exceptions and Errors are subclasses of Throwable.

Throwable is a subclass of FileNotFoundException.

FileNotFoundException class is a subclass of Exception but not a


subclass of RuntimeException.

ArrayIndexOutOfBoundsException is a RuntimeException.

Duckademy IT courses – www.duckademy.com


6. What is true for checked exceptions?

You have to denote its throwing.

They can move through your program without noting them.

Obey the throw-or-catch rule.

Subclasses of RuntimeException

Subclasses of Exception but not RuntimeException

7. What is true for unchecked exceptions?

You have to denote its throwing.

They can move through your program without noting them.

Obey the throw-or-catch rule.

Subclasses of RuntimeException

Subclasses of Exception but not RuntimeException

Duckademy IT courses – www.duckademy.com


----------------------------------------------------------------------------------------------------------------

The answers

1. Exceptions…

… are errors.

X … denote exceptional situations that might be errors or something


you should handle.

X … are objects in Java.

… are people from the medieval ages.

X … are good for separating error handling from the normal algorithm.

2. Which keyword is used to create an exception?

throws

X throw

raise

create

catch

try

finally

3. Which keyword is used to get and handle an exception?

throws

throw

raise

create

X catch

try

finally

Duckademy IT courses – www.duckademy.com


4. What is the finally keyword for?

To denote that we are fed up with programming and need a holiday

To denote that a method can produce an exception

To denote the exception handling part in the code

X To denote a block of code that always run either there is an


exception or not.

5. What are true for the Exception class hierarchy?

Error class is a subclass of Exception.

X RuntimeException class is a subclass of Exception.

RuntimeException class is a subclass of NullPointerException.

X Exceptions and Errors are subclasses of Throwable.

Throwable is a subclass of FileNotFoundException.

X FileNotFoundException class is a subclass of Exception but


not a subclass of RuntimeException.

X ArrayIndexOutOfBoundsException is a RuntimeException.

6. What is true for checked exceptions?

X You have to denote its throwing.

They can move through your program without noting them.

X Obey the throw-or-catch rule.

Subclasses of RuntimeException

X Subclasses of Exception but not RuntimeException

Duckademy IT courses – www.duckademy.com


7. What is true for unchecked exceptions?

You have to denote its throwing.

X They can move through your program without noting them.

Obey the throw-or-catch rule.

X Subclasses of RuntimeException

Subclasses of Exception but not RuntimeException

Duckademy IT courses – www.duckademy.com

You might also like