COSC-1337 Chapter 11 Quiz

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

To read data from a binary file you create objects from the following classes: a. FileInputStream and DataInputStream b. File and PrintWriter c. File and Scanner d. BinaryFileReader and BinaryDataReader

a. FileInputStream and DataInputStream

An exception's default error message can be retrieved using this method. a. getMessage() b. GetErrorMessage() c. getDefaultMessage() d. getDefaultErrorMessage()

a. getMessage()

When you write a method that throws a checked exception, you must: a. have a throws clause in the method header b. override the default error method c. use each class only once in a method d. ensure that the error will occur at least once each time the program is executed

a. have a throws clause in the method header

All exceptions are instances of classes that extend this class a. RunTimeException b. Throwable c. Error d. Exception

b. Throwable

The IllegalArgumentException class extends the RuntimeException class, and is therefore: a. a checked exception class b. an unchecked exception class c. never used directly d. none of the above

b. an unchecked exception class

A(n) ________ is an object that is generated in memory as the result of an error or an unexpected event. a. exception handler b. exception c. default exception handler d. error message

b. exception

To write data to a binary file you create objects from the following classes: a. File and PrintWriter b. File and Scanner c. FileOutputStream and DataOutputStream d. BinaryFileWriter and BinaryDataWriter

c. FileOutputStream and DataOutputStream

When an exception is thrown: a. it must always be handled by the method that throws it b. the program terminates even if the exception is handled c. it must be handled by the program or by the default exception handler d. it may be ignored

c. it must be handled by the program or by the default exception handler

In a try/catch construct, after the catch statement is executed: a. the program returns to the statement following the statement in which the exception occurred b. the program terminates c. the program resumes at the statement that immediately follows the try/catch construct d. the program resumes at the first statement of the try statement

c. the program resumes at the statement that immediately follows the try/catch construct

The try statement may have an optional ________ clause, which must appear after all of the catch clauses. a. try-again b. finally c. default d. abort

d. abort


Kaugnay na mga set ng pag-aaral

NU370 Week 1 PrepU: Health, Wellness & Illness

View Set

Network+ Chapter 2 Review Questions

View Set

Driving Theory Test Multiple Choice

View Set

4th grade Eng. What Jo did? Story

View Set

Jensen Ch. 2: Health History and Interview

View Set