Study Help Me
Study Help Me
Study Help Me


question archive 1) The purpose of Exception handling (using try

1) The purpose of Exception handling (using try

Subject:Computer SciencePrice: Bought3

1) The purpose of Exception handling (using try...catch) is to handle common errors in your program.

- True

- False

2) Which of the following are examples of common exceptions? ( you can choose more than 1 if applicable)

- arithmetic overflow

- division by zero

- memory exhaution

- array index in bounds

3) When a try block is executedbut no exceptions are thrown, where does control pass when the try block has completed axecution?

- The last catch block.

- The finally block, if there is one, otherwise to the code after the last catch.

- The code after the last catch block.

- None of the above.

4) What happens if no catch handler matches the type of a thrown object?

- If there is a finally block, it is axecuted and a search for the match is continued in the next enclosing try statement.( If no match is found, the program thread terminates early).

- The program thread terminates early.

- The exception is ignored.

- None of the above.

5) What happens if multiple catch blocks match the type of thrown object?

- The last one matches the exception is executed.

- The current program thread stops executing.

- The first catch block afterthe try that matches the exception is executed.

- None of the above.

6) The exception thrown by the Scanner class when executing method nextInt, and invalid chars are entered for the int is:

- ArithmeticException

- IndexOutOfBoundsException

- InputMismatchException

- IOException

7) The exception thrown when the program executes a division where the denominator is 0 is:

- IOException

- ArithmeticException

-InputMismatchException

- None of the above

8) The difference between a checked exception and unchecked exception is:

-The compilor verifies that all checked exceptions thrown by each method are caught in the calling code (or declared in a throw clause).

- The JVM verifies that all checked exceptions thrown by each method are caught in the calling code (or declaredin a throw clause).

- Java catches all checked exceptions automatically if the programmer has not done so.

- None of the above.

9) Does declaring a catch of a superclass exception catch all of the subclasses exceptions of that superclass?

- True

- False

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE
assignment helpassignment helperassignment expertsassignment writing services