Exam 10: Exceptions and Advanced File Io

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

The catch clause

Free
(Multiple Choice)
4.9/5
(85)
Correct Answer:
Verified

D

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

Free
(Multiple Choice)
4.8/5
(76)
Correct Answer:
Verified

D

In a try statement, the try clause must appear first, followed by all of the catch clauses, followed by the optional finally clause.

Free
(True/False)
4.9/5
(82)
Correct Answer:
Verified

True

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

(Multiple Choice)
4.8/5
(78)

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

(True/False)
4.7/5
(92)

The following catch clause catch (Exception e)

(Multiple Choice)
4.9/5
(72)

The ability to catch multiple types of exceptions with a single catch clause is known as multi-catch and was introduced in Java7.

(True/False)
4.9/5
(82)

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

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

(Multiple Choice)
4.8/5
(74)

Beginning with Java7, you can use __________ to reduce a lot of duplicated code in a try statement needs to catch multiple exceptions, but performs the same operation for each one.

(Multiple Choice)
4.8/5
(85)

A(n) __________ is a section of code that gracefully responds to exceptions when they are thrown.

(Multiple Choice)
4.9/5
(69)

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

Which of the statements below give an alternative way to write the following: FileInputStream fstream = new FileInputStream("info.dat"); DataInputStream inputFile = new DataInputStream(fstream);

(Multiple Choice)
4.8/5
(88)

When an exception is thrown by code in its try block, the JVM begins searching the try statement for a catch clause that can handle it and passes control of the program to

(Multiple Choice)
4.9/5
(90)

What happens if a program does not handle an unchecked exception?

(Multiple Choice)
4.9/5
(85)

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

(Multiple Choice)
4.9/5
(79)

When catching multiple exceptions that are related to one another through inheritance you should handle the more general exception classes before the more specialized exception classes.

(True/False)
4.9/5
(87)

A(n) __________ contains one or more statements that are executed and can potentially throw an exception.

(Multiple Choice)
4.8/5
(79)

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

When an exception is thrown

(Multiple Choice)
4.8/5
(88)
Showing 1 - 20 of 40
close modal

Filters

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