Exam 11: Handling Exceptions and Events

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

During program execution, if division by zero occurs with integer values and is not addressed by the program, then the program terminates with an error message indicating an attempt to divide by zero.

(True/False)
4.8/5
(44)

The class Throwable is derived from the class Exception.

(True/False)
4.8/5
(36)

import java.util.*; Public class ExceptionExample1 { Static Scanner console = new Scanner(System.in); public static void main(String[] args) { Int dividend, divisor, quotient; try { System.out.print("Enter dividend: "); Dividend = console.nextInt(); System.out.println(); System.out.print("Enter divisor: "); Divisor = console.nextInt(); System.out.println(); Quotient = dividend / divisor; System.out.println("quotient = " + quotient); } Catch (ArithmeticException aeRef) { System.out.println("Exception" + aeRef.toString()); } Catch (InputMismatchException imeRef) { System.out.println("Exception " + imeRef.toString()); } Catch( IOException ioeRef) { System.out.println("Exception " + ioeRef.toString()); } } }Which of the following inputs would be caught by the second catch block in the program in the accompanying figure?

(Multiple Choice)
4.8/5
(20)

Which of the following is NOT a typical action of the catch block?

(Multiple Choice)
4.9/5
(33)

The class Object is derived from the class Throwable.

(True/False)
4.7/5
(35)

int number; Boolean done = false;do { Try { System.out.print("Enter an integer: "); Number = console.nextInt(); System.out.println(); Done = true; System.out.println("number = " + number); } Catch (InputMismatchException imeRef) { Str = console.next(); System.out.println("Exception " + imeRef.toString() + " " + str); } } While (!done);Which exception-handling technique is the code in the accompanying figure using?

(Multiple Choice)
4.9/5
(27)

The order in which catch blocks are placed in a program has no impact on which catch block is executed.

(True/False)
4.8/5
(45)

Which of the following statements is NOT true about creating your own exceptions?

(Multiple Choice)
4.8/5
(41)

The try block contains statements that should be executed regardless of whether or not an exception occurs.

(True/False)
4.8/5
(38)

If you have a reference to an exception object, you can use the reference to throw the exception.

(True/False)
4.8/5
(43)
Showing 41 - 50 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)