Exam 11: Exceptions and Advanced File Io

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

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

(True/False)
4.8/5
(31)

In a multi-catch (introduced in Java 7) the exception types are separated in the catch clause by the __________ symbol.

(Multiple Choice)
4.9/5
(33)

When an exception is thrown __________.

(Multiple Choice)
4.8/5
(38)

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

In 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.7/5
(28)

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

(Multiple Choice)
4.9/5
(32)

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

A file that contains raw binary data is known as a __________.

(Multiple Choice)
4.7/5
(33)

If a random access file contains a stream of characters, which of the following statements would move the file pointer to the starting byte of the fifth character in the file?

(Multiple Choice)
4.7/5
(48)

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

(True/False)
4.8/5
(32)

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

(Multiple Choice)
4.8/5
(34)

What will be the result of the following statements? FileOutputStream fstream = new FileOutputStream("Output.dat"); DataOutputStream outputFile = new DataOutputStream(fstream);

(Multiple Choice)
4.9/5
(43)

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

(Multiple Choice)
4.8/5
(38)

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

(Multiple Choice)
4.8/5
(38)

The throws clause causes an exception to be thrown.

(True/False)
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
(31)

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

(True/False)
4.9/5
(38)

Given the following constructor code, which of the statements are true? public Book(String ISBNOfBook, double priceOfBook, Int numberOrderedOfBook) { 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
(39)

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

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

Filters

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