Ch. 16 Exceptions, Templates, and the Standard Template Library Flashcards
The line containing a throw statement is known as the ________.
Throw Point
The ________ block contains code that directly or indirectly might cause an exception to be thrown.
Try
The ______ block handles an exception.
Catch
When writing function or class templates, you use a(n) ________ to specify the generic data type.
Type Parameter
The beginning of a template is marked by a(n) ______.
Template Prefix
When defining objects of class templates, the ________ you wish to pass into the type parameter must be specified.
Data Type
A(n) ______ template works with a specific data type.
Specialized
A(n) ________ container organizes data in a sequential fashion similar to an array.
Sequence
A(n) _______ container uses keys to rapidly access elements.
associative
_______ are pointer like objects used to access data stored in a container.
Iterators
The ________ exception is thrown when the new operator fails to allocate the requested amount of memory.
bad_alloc
There can only be one catch block in a program. t/f
false
When an exception is thrown, but not caught, the program ignores the error. t/f
false
Data may be passed with an exception by storing it in members of an exception class. t/f
true
Once an exception has been thrown, it is not possible for the program to jump back to the throw point.
true
All type parameters defined in a function template must appear at least once in the function parameter list. t/f
true
The compiler creates an instance of a function template in memory as soon as it encounters the template. t/f
false
A class object passed to a function template must overload any operators used on the class object by the template. t/f
true
Only one generic type may be used with a template. t/f
false
In the function template definition, it is not necessary to use each type parameter declared in the template prefix. t/f
false
It is possible to overload two function templates. t/f
true
It is possible to overload a function template and an ordinary (nontemplate) function. t/f
true
A class template may not be derived from another class template. t/f
false
A class template may not be used as a base class. t/f
false
Specialized templates work with a specific data type. t/f
true
When defining an iterator from the STL, the compiler automatically creates the right kind, depending upon the container it is to be used with. t/f
true
STL algorithms are implemented as function templates. t/f
true