Chapter 14 Flashcards
True or false:
An exception is an occurrence of an undesirable situation that can be detected during program compilation.
False
True or false:
One of the typical ways of dealing with exceptions is to use an if statement.
True
True or false:
The heading of a try block can contain ellipses in place of a parameter.
False
True or false:
A catch block specifies the type of exceptions it can catch and immediately terminates the program.
False
True or false:
If no exception is thrown in a try block, all catch blocks associated with that try block are ignored.
True
True or false:
An object that is being thrown cannot be an anonymous object.
False
True or false:
The order of the catch blocks does not affect the program
False
True or false:
If the catch block with an ellipses in the heading is needed, then it should be in the first catch block in a sequence of try/catch blocks.
False
True or false:
C++ provides all the exception classes you will ever need.
False
True or false:
In C++, any class can be considered an exception class.
True
An _______ is an occurrence of an undesirable situation that can be detected during program execution.
exception
The function _____ can check whether an expression meets the required conditions; if the conditions are not met, it terminates the program.
assert
When division by zero occurs and the problem is not addressed, the program crashes with an error message that is _____ dependent.
IDE
To use the assert function in your program, you should include the statement _______
include <cassert></cassert>
The statements that may generate an exception are placed in a ______ block.
try
Which of the following blocks is designed to catch any type of exception?
catch(…){}