Deck 21: Standard Template Library (STL)
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 21: Standard Template Library (STL)
1
All containers use the same names for the common operations.
True
2
Input iterators,with read access,step forward element by element.
True
3
____ returns the maximum number of elements that can be inserted into the vector container vecCont without reallocation.
A) vecCont.size()
B) vecCont.max_size()
C) vecCont.capacity()
D) vecCont.length()
A) vecCont.size()
B) vecCont.max_size()
C) vecCont.capacity()
D) vecCont.length()
C
4
Functions begin and end do not take any parameters.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
Every object in a(n)____ container has a specific position.
A) adapter
B) sequence
C) associative
D) static
A) adapter
B) sequence
C) associative
D) static
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
If the data needs to be processed in a(n)____ manner,use a queue.
A) FILO
B) LILO
C) LIFO
D) FIFO
A) FILO
B) LILO
C) LIFO
D) FIFO
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
The first element in a vector container is at location 1.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
____ is a sequence container.
A) vector
B) stack
C) queue
D) set
A) vector
B) stack
C) queue
D) set
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
The STL has three main components: ____.
A) containers, iterators, and algorithms
B) functions, iterators, and algorithms
C) containers, constants, and algorithms
D) containers, iterators, and procedures
A) containers, iterators, and algorithms
B) functions, iterators, and algorithms
C) containers, constants, and algorithms
D) containers, iterators, and procedures
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
A container's ____ executes when the object goes out of scope.
A) default constructor
B) destructor
C) copy constructor
D) iterator
A) default constructor
B) destructor
C) copy constructor
D) iterator
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
An iterator to a vector container is declared using the ____ iterator.
A) new
B) vector
C) typedef
D) typeiter
A) new
B) vector
C) typedef
D) typeiter
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
The vector container stores and manages its objects in a dynamic array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
If data needs to be processed in a LIFO manner,use a ____.
A) stack
B) linked list
C) queue
D) deque
A) stack
B) linked list
C) queue
D) deque
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
The container member function ____ returns the position of one past the last element in the container.
A) last
B) end
C) back
D) pop
A) last
B) end
C) back
D) pop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
Some containers do not contain the member function end.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
Output iterators can be used to iterate over a range twice.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
The name of the class that implements the vector container is container.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
You must use the container name,the container element type,and the scope resolution operator to use the typedef iterator.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
The ____ operation on a vector container deletes the last element.
A) vecList.pop_back()
B) vecList.pop()
C) vecList.push_back()
D) vecList.back()
A) vecList.pop_back()
B) vecList.pop()
C) vecList.push_back()
D) vecList.back()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
The deq.front()operation on a deque object checks whether the container is empty.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
The ____________________ iterator is used to input data into a program from an input stream.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
If consecutive elements in listCont have the same value,the ____ operation removes the duplicates.
A) listCont.remove()
B) listCont.duplicate()
C) listCont.remove(duplicate)
D) listCont.unique()
A) listCont.remove()
B) listCont.duplicate()
C) listCont.remove(duplicate)
D) listCont.unique()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
If a container is declared as ____,then we must prevent the iterator from modifying the elements of the container,especially accidentally.
A) static
B) const
C) public
D) private
A) static
B) const
C) public
D) private
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
Elements in a(n)____ container are automatically sorted according to some ordering criteria.
A) sequence
B) associative
C) sorted
D) adapter
A) sequence
B) associative
C) sorted
D) adapter
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
Every container contains the typedef ____________________.An iterator of this type is used to iterate through the elements of a container in reverse.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
____ is a nonmodifying algorithm.
A) equal
B) copy
C) fill
D) sort
A) equal
B) copy
C) fill
D) sort
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
The ____ operation returns a pointer to the position before the first element in container ct.
A) ct.front()
B) ct.rbegin()
C) ct.rend()
D) ct.end()
A) ct.front()
B) ct.rbegin()
C) ct.rend()
D) ct.end()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
The ____ operation removes the first element from the deque object deq.
A) deq.front()
B) deq.push_front()
C) deq.pop_front()
D) deq.push()
A) deq.front()
B) deq.push_front()
C) deq.pop_front()
D) deq.push()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
The class ____ contains the definition of an output stream iterator.
A) iostream
B) iostream_iterator
C) ostream
D) ostream_iterator
A) iostream
B) iostream_iterator
C) ostream
D) ostream_iterator
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
Predicates are special types of function objects that return ____ values.
A) character
B) string
C) Boolean
D) Integer
A) character
B) string
C) Boolean
D) Integer
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
A function object contains a function that can be treated as a function using the ____ operator.
A) *
B) ::
C) ()
D) .
A) *
B) ::
C) ()
D) .
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
In the ____ sort algorithm,the array containing the data is viewed as a binary tree.
A) modifying
B) heap
C) nonmodifying
D) numeric
A) modifying
B) heap
C) nonmodifying
D) numeric
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
____ containers allow elements to be inserted at both ends.
A) Queue
B) Deque
C) Stack
D) List
A) Queue
B) Deque
C) Stack
D) List
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
The definition of the function template copy is contained in the header file ____.
A) algorithm
B) copy
C) ioinput
D) std
A) algorithm
B) copy
C) ioinput
D) std
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
List containers are implemented as doubly ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
The ____ typedef iterators is common to all containers.
A) random_access
B) bidirectional
C) pointer
D) forward
A) random_access
B) bidirectional
C) pointer
D) forward
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
____ is a modifying algorithm.
A) min
B) find
C) merge
D) count
A) min
B) find
C) merge
D) count
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
The term ____________________ stands for double-ended queue.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
Random access iterators are ____ iterators that can randomly process the elements of a container.
A) bidirectional
B) forward
C) input
D) output
A) bidirectional
B) forward
C) input
D) output
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
____________________ iterators are forward iterators that can also iterate backward over the elements.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
____________________ predicates check a specific property for a pair-that is,two arguments.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
The operator ____________________,supported by the queue container class,removes the next element in the queue.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
The only difference between the containers set and multiset is that the container multiset allows ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
The associated header file of the sequence container multimap is ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
The ____________________ iterators are used to output data from a program into an output stream.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
The operator ____________________,supported by the queue container class,returns the next (i.e.,first)element in the queue,but does not remove the element from the queue.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
The operator ____________________,supported by the stack container class,inserts a copy of item onto the stack.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
____________________ predicates check a specific property for a single argument.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The expression ct.____________________ deletes all of the elements from the container ct.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
The operator ____________________,supported by the stack container class,returns the actual number of elements in the stack.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck