Exam 12: Exceptions and Advanced File Io

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

A class must implement the Serializable interface in order for objects of the class to be serialized.

(True/False)
4.7/5
(43)

To serialize an object and write it to the file,use this method of the ObjectOutputStream class.

(Multiple Choice)
4.9/5
(36)

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.9/5
(43)

All of the exceptions that you will handle are instances of classes that extend this class.

(Multiple Choice)
4.8/5
(41)

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
(42)

All exceptions are instances of classes that extend this class.

(Multiple Choice)
5.0/5
(30)

Classes that inherit from the Error class are

(Multiple Choice)
4.8/5
(42)

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

(Multiple Choice)
5.0/5
(40)

If the program does not handle an unchecked exception,

(Multiple Choice)
4.8/5
(26)

When an exception is thrown,

(Multiple Choice)
4.8/5
(39)

If class,SerializedClass,contains references to objects of other classes as fields,those classes must also implement the Serializable interface in order to be serialized.

(True/False)
4.8/5
(40)

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 go execute that method.

(True/False)
4.9/5
(44)

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
(34)

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.8/5
(36)

The throws clause causes an exception to be thrown.

(True/False)
4.9/5
(40)

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

(Multiple Choice)
4.9/5
(35)

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.9/5
(32)

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.8/5
(49)

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

(Multiple Choice)
4.9/5
(40)

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

(Multiple Choice)
4.8/5
(35)
Showing 21 - 40 of 46
close modal

Filters

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