chapter 16 Flashcards
(39 cards)
These are used to signal errors or unexpected events that occur while a program is running.
A) Virtual functions
B) Destructors
C) Exceptions
D) Templates
E) None of these
C
The ________ starts with the key word try, and is followed by a block of code executing any statements that
might cause an exception to be thrown.
A) try block
B) try/catch class
C) try() function
D) catch() function
E) None of these
A
When an error occurs, an exception is ________.
A) created
B) thrown
C) passed
D) ignored
E) None of these
B
An exception thrown from outside a try block ________.
A) will be caught outside the catch block
B) will be caught inside the catch block
C) will remain inside the throw block
D) will cause the program to abort execution
E) None of these
D
f an exception is thrown by a member function of a class object, then the class ________ is called.
A) constructor
B) destructor
C) catcher
D) handler
E) None of these
B
n a function template, the programmer substitutes ________ for ________.
A) parameters, data types
B) parameters, arguments
C) arguments, parameters
D) angle brackets, parentheses
E) None of these
A
A(n) ________ is used in a function template to specify a generic data type.
A) dummy variable
B) exception
C) catch block
D) type parameter
D
he beginning of a function template is marked by a ________.
A) return type
B) parameter list
C) template prefix
D) semicolon
E) None of these
C
In the following statement:
template < class T >
What does T represent?
A) the name of the function template
B) “T” stands for “Template”
C) a generic data type that is used in a function template
D) the int data type
E) None of these
C
Class templates allow you to create one general version of a class without having to ________.
A) write any code
B) use member functions
C) use private members
D) duplicate code to handle multiple data types
E) None of these
D
n the following statement:
template <class>
What does the word class indicate?
A) class is a key word that is used to precede the type parameter T.
B) You are deriving a class from an existing class called T.
C) You are deriving a class called T from a class called template.
D) A class named T will automatically be created by the compiler.
E) None of these</class>
A
Two types of container classes in the STL are:
A) sequence and associative
B) box and cylinder
C) array and struct
D) constant and literal
E) None of these
A
A(n) ________ is like a pointer. It is used to access the individual data elements in a container.
A) element access operator
B) subscript indicator
C) global data finder
D) iterator
E) None of these
D
The three sequence container objects provided by the STL are:
A) set, multiset, map
B) vector, deque, list
C) map, list, array
D) multimap, map, multilist
E) None of these
B
A(n) ________ is a value or an object that signals an error.
A) destructor
B) template
C) throw
D) exception
E) None of these
D
To handle an exception that has been thrown, a program must have a(n) ________.
A) throw() function
B) try/catch construct
C) fatal error
D) unrecoverable error
E) None of these
B
The try block is immediately followed by one or more ________.
A) errors
B) error messages
C) catch blocks
D) throw blocks
E) None of these
C
Catch blocks serve as ________.
A) exception handlers
B) wide receivers
C) temporary variables
D) permanent storage for trapped errors
E) None of these
A
This is a “generic” function that can work with any data type.
A) function argument
B) function parameter
C) function template
D) member function
E) None of these
C
How much memory is reserved for a function template?
A) four bytes
B) eight bytes
C) two bytes
D) no memory
E) None of these
D
All type parameters defined in a function template must appear at least once in the ________.
A) function parameter list
B) preprocessor directives
C) function call
D) type.h file
E) None of these
A
A function template’s prefix contains ________ enclosed in angled brackets.
A) one or more generic data types
B) the function definition
C) constant values
D) the function’s return type
E) None of these
A
An actual instance of the function is created in memory when the compiler encounters ________.
A) the template prefix
B) a call to the template function
C) a try block
D) a catch block
E) None of these
B
A function template prefix is placed before the function header. A class template prefix is placed ________.
A) following the public: access specification
B) following the private: access specification
C) before the class declaration
D) before the class constructor function header
E) None of these
C