Exam 11: Exceptions and Advanced File IO

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

The ability to catch multiple types of exceptions with a single catch is known as ________, and was introduced in Java 7.

(Multiple Choice)
4.8/5
(37)

Beginning in Java 7, multi-catch can reduce a lot of duplicated code in a try statement that needs to catch multiple exceptions, but perform the same operation for each one.

(True/False)
4.8/5
(42)

The numeric classes' "parse" methods all throw an exception of this type if the string being converted does not contain a convertible numeric value.

(Multiple Choice)
4.9/5
(33)

If, within one try statement you want to have catch clauses of the following types, in which order should they appear in your program: (1) Exception (2) IllegalArgumentException (3) RuntimeException (4) Throwable

(Multiple Choice)
4.7/5
(40)

If your code does not handle and exception when it is thrown, this prints an error message and crashes the program.

(Multiple Choice)
4.9/5
(36)

This is a section of code that gracefully responds to exceptions when they are thrown.

(Multiple Choice)
4.9/5
(35)

The throw statement informs the compiler that a method throws one or more exception.

(True/False)
4.9/5
(33)

In a try/catch construct, after the catch statement is executed:

(Multiple Choice)
4.8/5
(43)

A catch clause that uses a parameter variable of the Exception type is capable of catching any exception that extends the Error class.

(True/False)
4.7/5
(40)

Classes that inherit from the Error class are:

(Multiple Choice)
4.9/5
(34)

When an object is serialized, it is converted into a series of bytes that contain the object's data.

(True/False)
4.8/5
(32)

If a random access file contains a stream of characters, which of the following would you use to set the pointer on the fifth character?

(Multiple Choice)
4.9/5
(40)

An exception's default error message can be retrieved using this method.

(Multiple Choice)
4.7/5
(33)

Under Windows, which of the following statements will open the file InputFile.txt that is in the root directory on the C: drive?

(Multiple Choice)
4.8/5
(36)

In a multi-catch, (introduced in Java 7) the exception types are separated in the catch clause by this symbol:

(Multiple Choice)
4.8/5
(31)

In the following code, assume that inputFile references a Scanner object that has been successfully used to open a file: double totalIncome = 0.0; While (inputFile.hasNext()) { Try { TotalIncome += inputFile.nextDouble(); } Catch(InputMismatchException e) { System.out.println("Non-numeric data encountered " + "in the file."); InputFile.nextLine(); } Finally { TotalIncome = 35.5; } } What will be the value of totalIncome after the following values are read from the file? 2)5 8)5 3)0 5)5 Abc 1)0

(Multiple Choice)
4.8/5
(36)
Showing 41 - 56 of 56
close modal

Filters

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