Exam 10: Exceptions and Advanced File Io

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

When using the throw statement, if you don't pass a message to the exception object's constructor,

(Multiple Choice)
4.9/5
(45)

The RandomAccessFile class treats a file as a stream of

(Multiple Choice)
4.7/5
(38)

An exception object's default error message can be retrieved using the __________ method.

(Multiple Choice)
4.9/5
(35)

In a catch statement, what does the following code do? System.out.println(e.getMessage());

(Multiple Choice)
4.8/5
(40)

Classes that inherit from the Error class are for exceptions that are thrown when

(Multiple Choice)
4.8/5
(34)

To write data to a binary file, you create objects from which of the following classes?

(Multiple Choice)
4.8/5
(34)

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

(Multiple Choice)
4.9/5
(37)

The throws clause causes an exception to be thrown.

(True/False)
4.7/5
(31)

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

(True/False)
4.8/5
(40)

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

(True/False)
4.9/5
(41)

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

(Multiple Choice)
4.9/5
(26)

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

(True/False)
4.9/5
(40)

What will the following code display? String input = "99#7"; Int number; Try { Number = Integer.parseInt(input); } Catch(NumberFormatException ex) { Number = 0; } Catch(RuntimeException ex) { Number = 1; } Catch(Exception ex) { Number = -1; } System.out.println(number);

(Multiple Choice)
4.8/5
(37)

If a class has fields that are objects of other classes, those classes do not need to implement the Serializable interface to be serialized.

(True/False)
4.8/5
(34)

Unchecked exceptions are those that inherit from the

(Multiple Choice)
4.8/5
(33)

A file that contains raw binary data is known as a

(Multiple Choice)
4.9/5
(39)

What will be the result of the following statements? FileInputStream fstream = new FileInputStream("Input.dat"); DataInputStream inFile = new DataInputStream(fstream);

(Multiple Choice)
4.9/5
(37)

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

In order for an object to be serialized, the class must implement the __________ interface.

(Multiple Choice)
4.8/5
(42)

In Java there are two categories of exceptions which are

(Multiple Choice)
5.0/5
(34)
Showing 21 - 40 of 40
close modal

Filters

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