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.
Explanation: 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...

Select all that apply. Select as many of the following options that make this sentence true: The contents of pointer variables may be changed with mathematical statements that perform

a. multiplication b. division c. addition d. subtraction e. modulus

Computer Science & Information Technology

Case-Based Critical Thinking QuestionsCase 6-3Larry has just bought an online Web hosting solution from a popular ISP. He knows the ISP provides some scripts to allow people to create logon pages for their Web site if they want to have a password-protected blog, for example. Larry wants to create such a page for his blog about video games. Before Larry builds his form, which of the following should he consult concerning required fields?

A. his ISP B. his other Web pages C. his desired form design D. none of the above

Computer Science & Information Technology

Access is made up of different types of ________, which may include tables, forms, reports, and queries

Fill in the blank(s) with correct word

Computer Science & Information Technology

____ is defined as a business process to service a request associated with an identity.

A. Workflow B. DN C. Provisioning D. Data broker

Computer Science & Information Technology