Deck 16: Exceptions, Templates, and the Standard Template Library STL

ملء الشاشة (f)
exit full mode
سؤال
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
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
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
سؤال
The beginning of a function template is marked by a

A) return type.
B) parameter list.
C) template prefix.
D) semicolon.
E) None of these
سؤال
In the following statement template
What does the word class indicate?

A) class is a keyword 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
سؤال
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
سؤال
The _______ starts with the keyword 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
سؤال
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
سؤال
A(n) ____________ is a value or an object that signals an error.

A) destructor
B) template
C) throw
D) exception
E) None of these
سؤال
Catch blocks serve as ________________.

A) exception handlers
B) wide receivers
C) temporary variables
D) permanent storage for trapped errors
E) None of these
سؤال
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
سؤال
In 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
سؤال
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
سؤال
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
سؤال
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
سؤال
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
سؤال
If 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
سؤال
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
سؤال
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
سؤال
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
سؤال
When an error occurs, an exception is

A) created
B) thrown
C) passed
D) ignored
E) None of these
سؤال
A sequence container organizes data in a sequential fashion, similar to an array.
سؤال
Using a function template requires less code than overloading a function.
سؤال
Function templates allow you to write a single function definition that works with many different data types.
سؤال
The try/catch/throw construct is able to handle only one type of exception in a try block.
سؤال
An associative container uses these to access elements rapidly.

A) data
B) functions
C) keys
D) complex sort algorithms
E) None of these
سؤال
Types of iterators are

A) input and output
B) forward and bidirectional
C) random-access
D) All of these
E) None of these
سؤال
The Standard Template Library (STL) contains templates for useful algorithms and data structures.
سؤال
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
سؤال
There is no difference between declaring an object of an ordinary class and an object of a template class.
سؤال
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
سؤال
A(n)__________ is a class that stores data and organizes it in some fashion.

A) iterator
B) container
C) template
D) box
E) None of these
سؤال
The most important data structures in the STL are _______ and _________.

A) arrays, structs
B) lists, groups
C) containers, iterators
D) templates, prototypes
E) None of these
سؤال
When you declare an iterator to work with a container, the compiler automatically chooses the right type.
سؤال
A program may not contain both a "regular" version of a function and a template version of the function.
سؤال
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
سؤال
If an exception is not caught, it is stored for later use.
سؤال
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
سؤال
The line containing a throw statement is known as the throw point.
سؤال
The algorithms provided by the STL are implemented as _____________, and perform various operations on elements of containers.

A) virtual functions
B) function templates
C) global variables
D) private data members
E) None of these
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/39
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 16: Exceptions, Templates, and the Standard Template Library STL
1
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
2
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
3
The 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
4
In the following statement template
What does the word class indicate?

A) class is a keyword 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
5
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
6
The _______ starts with the keyword 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
7
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
8
A(n) ____________ is a value or an object that signals an error.

A) destructor
B) template
C) throw
D) exception
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
9
Catch blocks serve as ________________.

A) exception handlers
B) wide receivers
C) temporary variables
D) permanent storage for trapped errors
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
10
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
11
In 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
12
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
13
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
14
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
15
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
16
If 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
17
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
18
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
19
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
20
When an error occurs, an exception is

A) created
B) thrown
C) passed
D) ignored
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
21
A sequence container organizes data in a sequential fashion, similar to an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
22
Using a function template requires less code than overloading a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
23
Function templates allow you to write a single function definition that works with many different data types.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
24
The try/catch/throw construct is able to handle only one type of exception in a try block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
25
An associative container uses these to access elements rapidly.

A) data
B) functions
C) keys
D) complex sort algorithms
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
26
Types of iterators are

A) input and output
B) forward and bidirectional
C) random-access
D) All of these
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
27
The Standard Template Library (STL) contains templates for useful algorithms and data structures.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
28
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
29
There is no difference between declaring an object of an ordinary class and an object of a template class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
30
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
31
A(n)__________ is a class that stores data and organizes it in some fashion.

A) iterator
B) container
C) template
D) box
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
32
The most important data structures in the STL are _______ and _________.

A) arrays, structs
B) lists, groups
C) containers, iterators
D) templates, prototypes
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
33
When you declare an iterator to work with a container, the compiler automatically chooses the right type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
34
A program may not contain both a "regular" version of a function and a template version of the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
35
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
36
If an exception is not caught, it is stored for later use.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
37
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
38
The line containing a throw statement is known as the throw point.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
39
The algorithms provided by the STL are implemented as _____________, and perform various operations on elements of containers.

A) virtual functions
B) function templates
C) global variables
D) private data members
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 39 في هذه المجموعة.