APCS - Java - Unit 13

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following statements is false? I. When Java creates an exception object, the object contains information about how to handle the exception whenever possible. II. A stack trace contains information about where an exception occurred. III. An exception must be of type Throwable or one of its subclasses. Select one: A. I only B. II only C. III only D. I and III only E. II and III only

The correct answer is A: I only

Which of the following exceptions is a checked exception? Select one: A. ArithmeticException. B. IOException. C. RuntimeException. D. InputMismatchException. E. None of the above

The correct answer is B: IOException.

Throwing an exception from a catch block that wraps the original exception's information with the new exception's information forms a __________. Select one: A. multi-threaded exception B. chained exception C. compound exception D. recalled exception E. none of the above

The correct answer is B: chained exception

The keyword __________ is used to throw an exception. Select one: A. try B. throw C. catch D. throwable E. throws

The correct answer is B: throw

The __________ keyword is used to indicate that a block of code may throw exceptions. Select one: A. throws B. try C. catch D. throwable E. throw

The correct answer is B: try

The __________ keyword is used to define a block of code that handles an exception. Select one: A. try B. throws C. catch D. finally E. catches

The correct answer is C: catch

All exception classes inherit, either directly or indirectly, from: Select one: A. class Error B. classCheckedException C. class Exception D. class ThrownException E. None of the above

The correct answer is C: class Exception

When an exception is thrown but not caught in a particular scope, a process called __________ is initiated. Select one: A. abnormal termination B. exception reporting C. stack unwinding D. exception handling E. none of the above

The correct answer is C: stack unwinding

Which of the following statements is true? I. Exception handling enables programmers to write robust and fault-tolerant programs. II. Exception handling can catch but not necessarily resolve exceptions. III. Exception handling can always resolve exceptions. Select one: A. I only B. II only C. III only D. I and II only E. I and III only

The correct answer is D: I and II only

If your program uses classes that can throw __________ exceptions, then it must be designed to handle those exceptions or it won't compile correctly. Select one: A. throwable B. internal C. external D. checked E. catchable

The correct answer is D: checked


Ensembles d'études connexes

Sociology Ch 2- Culture and Society

View Set

Adaptive Quizzes Chapter 65- Neuro Assessment and Chapter 67- Strokes

View Set

(Concept Checks) Chapter 3: Global Business

View Set

Essentials of Communication Unit 3 Quiz 3 Notes Quiz

View Set

Midterm Part 2 American Government (REAL)

View Set

Viruses, lytic and lysogenic cycles

View Set