An exception should be

a) Used within a function
b) Thrown outside a try block
c) Listed in an exception specification for the function where the exception is thrown
d) Thrown in a different function than it is caught in. (If you select this, tell how are these functions related?)
e) Reserved for a situation where the way an exception should be handled depends on how and where the function is used


All parts except b) are correct.

It is impossible not to do as Part a) suggests. Remember that main() is a function. If you do as b) suggests, your program will terminate. Part c) is desirable since it provides a measure of error checking of your code. Part d) is typical of exception use. The function where the exception is caught calls the function where the exception is thrown. Part e) might be a situation where a library in use detects an error. It doesn’t know what to do, but throws an exception. The application knows what to do, and catches the exception and handles it.

Computer Science & Information Technology

You might also like to view...

The following, =ABS(AVERAGE(C25:N25)) , is an example of a(n) ________ function

A) nested B) joined C) compound D) contiguous

Computer Science & Information Technology

Which of the following examines the organizational resource of information and regulates its definitions, uses, value, and distribution, ensuring it has the types of data or information required to function and grow effectively?

A. Information code B. Information technology C. Information management D. Information governance

Computer Science & Information Technology

_____ formatting is the process of changing the way letters, numbers, punctuation marks, and symbols appear on the screen and in print.

A. Document B. Character C. Paragraph D. Object

Computer Science & Information Technology

XML and relational databases are tightly woven together in most web applications. Describe the two distinctly different models XML and relational databases use to structure data.?

What will be an ideal response?

Computer Science & Information Technology