Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. The block of code that handles an exception is called Select one: a. the catc

ID: 3693756 • Letter: 1

Question

1.

The block of code that handles an exception is called

Select one:

a. the catch block.

b. the try block.

c. a function.

d. an error block.

2.

If a function throws an exception

Select one:

a. it must be caught in that function.

b. it may be caught in that function.

c. it causes a syntax error.

d. it can only be a non-numeric exception

3.

When a throw statement is executed

Select one:

a. execution of the try block stops.

b. execution of the throw block stops.

c. the program always exits.

d. execution of the catch block stops

4.

Functions that might throw an exception must have a throw list.

Select one:

True

False

5.

following class definition
class MyError
{};

Select one:

a. has no member functions or member data.

b. has only a default constructor.

c. is illegal.

d. has no member functions or member data and has only a default constructor

6.

Functions may potentially throw at most one exception.

Select one:

True

False

7.

The parameter in the catch statement

Select one:

a. identifies what type of exceptions are caught.

b. identifies the different number of exceptions that can be caught.

c. makes the catch block a function.

d. must always be an e.

8.

When an unusual situation or error occurs, then the ________ statement is executed.

Select one:

a. try

b. throw

c. error

d. exiting

9.

should use exception handling

Select one:

a. in all your programs.

b. only when you cannot handle the exception with simpler control structures.

c. only when you use classes.

d. in every function.

10

should use exception handling

Select one:

a. in all your programs.

b. only when you cannot handle the exception with simpler control structures.

c. only when you use classes.

d. in every function.

Explanation / Answer

1. a

2. a

3. a

4. False (There is no need of throw list because the catch exception handler catches the exception thrown by the 'throw' expression

5. a

6. False

7. d

8. b

9. b

10. b