MCQs > IT & Programming > Programming Languages MCQs > Exception Handling MCQs

Exception Handling MCQ

The ____ class represents more serious errors from which your program usually cannot recover.

Answer

Correct Answer: Error

Note: This Question is unanswered, help us to find answer for this one

Exceptions can be thrown by ________.

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

These exceptions are seen in


NullPointerException,

ArrayIndexOutOfBoundsException,

ArithmeticException,

NumberFormatException?


Answer

Correct Answer:

Unchecked Exception


Note: This Question is unanswered, help us to find answer for this one

We can prevent a function from throwing any exceptions.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

Catch handler can have multiple parameters.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

Exception handlers are declared with ____________ keyword.

Answer

Correct Answer: Catch

Note: This Question is unanswered, help us to find answer for this one

If the superclass method does not declare an exception, subclass overridden method cannot declare the checked exception?

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

Which allows us to control the normal flow of the program by using exception handling in program?

Answer

Correct Answer: Exception Handling

Note: This Question is unanswered, help us to find answer for this one

Which provides a default exception handler that performs the following tasks?


- Prints out exception description.

- Prints the stack trace (Hierarchy of methods where the exception occurred).

- Causes the program to terminate.


Answer

Correct Answer:

JVM


Note: This Question is unanswered, help us to find answer for this one

These five keywords are used in try, catch, finally, throw, and throws?

Answer

Correct Answer: Exception Handling

Note: This Question is unanswered, help us to find answer for this one

How can we restrict a function to throw certain exceptions?

Answer

Correct Answer: Defining function with throw clause

Note: This Question is unanswered, help us to find answer for this one

A try block can be nested under another try block –

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

The Exception class has two main subclasses?

Answer

Correct Answer: IOException class And RuntimeException Class

Note: This Question is unanswered, help us to find answer for this one

Return type of uncaught_exception() is________________.

Answer

Correct Answer: Bool

Note: This Question is unanswered, help us to find answer for this one

Which class is used when a program does not want to handle exceptions?

Answer

Correct Answer: Throws

Note: This Question is unanswered, help us to find answer for this one

If you are inserting any value in the wrong index as shown below, it would result in


1. int a[]=new int[5];

2. a[10]=50;


Answer

Correct Answer:

 ArrayIndexOutOfBoundsException



Note: This Question is unanswered, help us to find answer for this one

Which block contains a block of program statements within which an exception might occur?

Answer

Correct Answer: Try

Note: This Question is unanswered, help us to find answer for this one