Deck 4: Standard Template Library (STL) I

Full screen (f)
exit full mode
Question
Containers are class templates.
Use Space or
up arrow
down arrow
to flip the card.
Question
Algorithms are class templates.
Question
Every object in a sequence container has a specific position.
Question
Vector containers are logically the same as arrays.
Question
The name of the header file containing the class vector is vec.h.
Question
The class vector contains only one constructor.
Question
The statements vecList.at(index) and vecList[index] return different values.
Question
The expression vecList.front() moves an element to the front of the vector.
Question
The statement vecList.push_back(elem) deletes the element elem from the vector.
Question
The statement vecList.pop_back() puts the last deleted element back on the vector.
Question
The expression vecCont.empty() empties the vector container of all elements.
Question
The function copy can perform only one operation, which is to output the elements of a container.
Question
The function copy can copy the elements of a vector into another vector.
Question
The term deque stands for double-ended queue.
Question
The deque class is a type of container adapter.
Question
Elements can be inserted in the middle of a deque container.
Question
The class deque contains only one constructor.
Question
Assuming deq is a deque object, the expression deq.push_front(elem) deletes the first element from deq.
Question
Assuming deq is a deque object. the expression deq.back() returns the position of the last element of deq.
Question
Forward iterators combine all of the functionality of input iterators and almost all the functionality of output iterators.
Question
An iterator of the type const_iterator is a read-only iterator.
Question
An iterator works like a pointer.
Question
Every container contains the typedef reverse_iterator.
Question
An iterator of type const_reverse_iterator is used to iterate through the elements of a container in reverse.
Question
If the data needs to be processed in a Last In First Out (LIFO) manner, we typically use a(n) ____.

A) queue
B) map
C) hash table
D) stack
Question
If the data needs to be processed in a First In First Out (FIFO) manner, we typically use a(n) ____.

A) stack
B) queue
C) map
D) hash table
Question
The ____ provides class templates to process lists (contiguous or linked), stacks, and queues.

A) STL
B) ITL
C) CTL
D) ADL
Question
Containers are essentially used ____.

A) to manipulate data
B) to step through a set of given elements
C) to manage objects of a given type
D) to update objects that are part of a given set of elements
Question
A vector is a type of ____.

A) associative container
B) sequence container
C) container adapter
D) iterator
Question
The statement ____ declares intList to be a vector and the component type to be int.

A) vector<int> intList;
B) int.vector intList;
C) int.vector<int> intList;
D) vector.int intList<int>;
Question
Assuming vecList is a vector container, the expression ____ deletes all elements from the container.

A) vecList.erase(position)
B) vecList.erase(beg, end)
C) vecList.clear()
D) vecList.erase(all)
Question
The expression ____ advances the iterator intVecIter to the next element into the container.

A) --intVecIter
B) ++intVecIter
C) intVecIter.advance(1)
D) intVecIter(++)
Question
The expression ____ returns the element at the current iterator position.

A) intVecIter
B) &intVecIter
C) *intVecIter
D) intVecIter.ref
Question
The class ____ contains member functions that can be used to find the number of elements currently in the container, the maximum number of elements that can be inserted in a container, and so on.

A) container
B) element
C) template
D) vector
Question
A ____ encapsulates data, and operations on that data, into a single unit.

A) class
B) function
C) generic
D) member
Question
To use the template function copy, the program must include the statement ____.

A)# include <standard>
B) #include <math>
C)# include <operators>
D)# include <algorithm>
Question
The function ____ returns a pointer to the last element into a container.

A) rbegin
B) beginr
C) rend
D) endr
Question
To use a deque container in a program, the program must include the statement ____.

A)# include <queue>
B)# include <queues>
C) #include <deque>
D)# include <STL>
Question
The statement ____ advances cntItr so that it points to the next element in the container.

A) ++cntItr;
B) cntItr++;
C) *cntItr;
D) cntItr*;
Question
____ iterators, with read access, step forward element-by-element and so return the values element-by-element.

A) Standard
B) Input
C) Output
D) Migration
Question
____ iterators, with write access, step forward element-by-element.

A) Output
B) Input
C) Random access
D) Step
Question
____ iterators are forward iterators that can also iterate backward over the elements.

A) Input
B) Output
C) Bidirectional
D) Random access
Question
The effect of the expression rAccessIterator - n is that it ____.

A) deletes the nth element of the iterator
B) returns the iterator of the next nth element
C) returns the iterator of the previous nth element
D) moves rAccessIterator backwards n elements
Question
The typedef ____ iterator is a read-only iterator.

A) size_type
B) reverse_iterator
C) value_type
D) const_reference
Question
The ____ iterator is used to input data into a program from an input stream.

A) iostream
B) ostream
C) ifstream
D) istream
Question
The general syntax to use an istream iterator is ____.

A) istream_iterator<Type> isIdentifier(*istream);
B) istream_iterator<Type> isIdentifier(istream&);
C) istream_iterator isIdentifier(istream&);
D) istream_iterator isIdentifier(istream&<Type>);
Question
The ____ iterators are used to output data from a program into an output stream.

A) ostream
B) istream
C) iostream
D) ifstream
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/47
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 4: Standard Template Library (STL) I
1
Containers are class templates.
True
2
Algorithms are class templates.
False
3
Every object in a sequence container has a specific position.
True
4
Vector containers are logically the same as arrays.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
5
The name of the header file containing the class vector is vec.h.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
6
The class vector contains only one constructor.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
7
The statements vecList.at(index) and vecList[index] return different values.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
8
The expression vecList.front() moves an element to the front of the vector.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
9
The statement vecList.push_back(elem) deletes the element elem from the vector.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
10
The statement vecList.pop_back() puts the last deleted element back on the vector.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
11
The expression vecCont.empty() empties the vector container of all elements.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
12
The function copy can perform only one operation, which is to output the elements of a container.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
13
The function copy can copy the elements of a vector into another vector.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
14
The term deque stands for double-ended queue.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
15
The deque class is a type of container adapter.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
16
Elements can be inserted in the middle of a deque container.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
17
The class deque contains only one constructor.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
18
Assuming deq is a deque object, the expression deq.push_front(elem) deletes the first element from deq.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
19
Assuming deq is a deque object. the expression deq.back() returns the position of the last element of deq.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
20
Forward iterators combine all of the functionality of input iterators and almost all the functionality of output iterators.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
21
An iterator of the type const_iterator is a read-only iterator.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
22
An iterator works like a pointer.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
23
Every container contains the typedef reverse_iterator.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
24
An iterator of type const_reverse_iterator is used to iterate through the elements of a container in reverse.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
25
If the data needs to be processed in a Last In First Out (LIFO) manner, we typically use a(n) ____.

A) queue
B) map
C) hash table
D) stack
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
26
If the data needs to be processed in a First In First Out (FIFO) manner, we typically use a(n) ____.

A) stack
B) queue
C) map
D) hash table
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
27
The ____ provides class templates to process lists (contiguous or linked), stacks, and queues.

A) STL
B) ITL
C) CTL
D) ADL
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
28
Containers are essentially used ____.

A) to manipulate data
B) to step through a set of given elements
C) to manage objects of a given type
D) to update objects that are part of a given set of elements
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
29
A vector is a type of ____.

A) associative container
B) sequence container
C) container adapter
D) iterator
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
30
The statement ____ declares intList to be a vector and the component type to be int.

A) vector<int> intList;
B) int.vector intList;
C) int.vector<int> intList;
D) vector.int intList<int>;
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
31
Assuming vecList is a vector container, the expression ____ deletes all elements from the container.

A) vecList.erase(position)
B) vecList.erase(beg, end)
C) vecList.clear()
D) vecList.erase(all)
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
32
The expression ____ advances the iterator intVecIter to the next element into the container.

A) --intVecIter
B) ++intVecIter
C) intVecIter.advance(1)
D) intVecIter(++)
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
33
The expression ____ returns the element at the current iterator position.

A) intVecIter
B) &intVecIter
C) *intVecIter
D) intVecIter.ref
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
34
The class ____ contains member functions that can be used to find the number of elements currently in the container, the maximum number of elements that can be inserted in a container, and so on.

A) container
B) element
C) template
D) vector
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
35
A ____ encapsulates data, and operations on that data, into a single unit.

A) class
B) function
C) generic
D) member
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
36
To use the template function copy, the program must include the statement ____.

A)# include <standard>
B) #include <math>
C)# include <operators>
D)# include <algorithm>
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
37
The function ____ returns a pointer to the last element into a container.

A) rbegin
B) beginr
C) rend
D) endr
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
38
To use a deque container in a program, the program must include the statement ____.

A)# include <queue>
B)# include <queues>
C) #include <deque>
D)# include <STL>
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
39
The statement ____ advances cntItr so that it points to the next element in the container.

A) ++cntItr;
B) cntItr++;
C) *cntItr;
D) cntItr*;
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
40
____ iterators, with read access, step forward element-by-element and so return the values element-by-element.

A) Standard
B) Input
C) Output
D) Migration
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
41
____ iterators, with write access, step forward element-by-element.

A) Output
B) Input
C) Random access
D) Step
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
42
____ iterators are forward iterators that can also iterate backward over the elements.

A) Input
B) Output
C) Bidirectional
D) Random access
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
43
The effect of the expression rAccessIterator - n is that it ____.

A) deletes the nth element of the iterator
B) returns the iterator of the next nth element
C) returns the iterator of the previous nth element
D) moves rAccessIterator backwards n elements
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
44
The typedef ____ iterator is a read-only iterator.

A) size_type
B) reverse_iterator
C) value_type
D) const_reference
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
45
The ____ iterator is used to input data into a program from an input stream.

A) iostream
B) ostream
C) ifstream
D) istream
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
46
The general syntax to use an istream iterator is ____.

A) istream_iterator<Type> isIdentifier(*istream);
B) istream_iterator<Type> isIdentifier(istream&);
C) istream_iterator isIdentifier(istream&);
D) istream_iterator isIdentifier(istream&<Type>);
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
47
The ____ iterators are used to output data from a program into an output stream.

A) ostream
B) istream
C) iostream
D) ifstream
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 47 flashcards in this deck.