Exam 11: Exceptions and Advanced File IO

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

What is demonstrated by the following code? Try { (try block statements . . .) } Catch(NumberFormatException | IOException ex) { RespondToError(); }

(Multiple Choice)
4.9/5
(40)

If you want to append data to the existing binary file, BinaryFile.dat, use the following statements to open the file.

(Multiple Choice)
4.8/5
(31)

If the IOData.dat file does not exist, what will happen when the following statement is executed? RandomAccessFile randomFile = New RandomAccessFile("IOData.dat", "rw");

(Multiple Choice)
4.7/5
(48)

The call stack is an internal list of all the methods that are currently executing.

(True/False)
4.9/5
(39)

A(n) ________ is an object that is generated in memory as the result of an error or an unexpected event.

(Multiple Choice)
4.7/5
(41)

When writing a string to a binary file or reading a string from a binary file, it is recommended that you use:

(Multiple Choice)
4.8/5
(40)

The throws clause causes an exception to be thrown.

(True/False)
4.8/5
(39)

The catch clause:

(Multiple Choice)
4.9/5
(37)

When deserializing an object using the readObject method, you must cast the return value to the desired class type.

(True/False)
4.8/5
(41)

In versions of Java prior to Java 7, each catch clause can handle only one type of exception.

(True/False)
4.7/5
(46)

When the code in a try block may throw more than one type of exception, you need to write a catch clause for each type of exception that could potentially be thrown.

(True/False)
4.9/5
(32)

If a method does not handle a possible checked exception, what must the method have?

(Multiple Choice)
4.9/5
(43)

To write data to a binary file you create objects from the following classes:

(Multiple Choice)
5.0/5
(30)

The IllegalArgumentException class extends the RuntimeException class, and is therefore:

(Multiple Choice)
4.8/5
(34)

When an exception is thrown by a method that is executing under several layers of method calls, a stack trace indicates the method executing when an exception occurred and all of the methods that were called in order to execute that method.

(True/False)
4.8/5
(37)

If the program does not handle an unchecked exception:

(Multiple Choice)
4.9/5
(39)

Look at the following code: FileInputStream fstream = New FileInputStream("MyInfo.dat"); DataInputStream inputFile = New DataInputStream(fstream); This code can also be written as:

(Multiple Choice)
4.8/5
(42)

Assume that the classes BlankISBN, NegativePrice, and NegativeNumberOrdered are exception classes that inherit from Exception. The following code is a constructor for the Book class. What must be TRUE about any method that instantiates the Book class with this constructor? Public Book(String ISBNOfBook, double priceOfBook, Int numberOrderedOfBook) throws BlankISBN, NegativePrice, NegativeNumberOrdered { If (ISBNOfBook == "") Throw new BlankISBN(); If (priceOfBook < 0) Throw new NegativePrice(priceOfBook); If (numberedOrderedOfBook < 0) Throw new NegativeNumberOrdered(numberOrderedv); ISBN = ISBNOfBook; Price = priceOfBook; NumberedOrdered = numberOrderedOfBook; }

(Multiple Choice)
4.8/5
(41)

If the code in a method can potentially throw a checked exception, then that method must:

(Multiple Choice)
4.9/5
(39)

When you write a method that throws a checked exception, you must:

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

Filters

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