Ch. 15 Standard Library Containers
Iterators are similar to pointers because of the:
* and ++ operators.
Attributes of a heap do not include:
A preference to pop, rather than push, elements in the heap.
A Standard Library algorithm cannot:
Access Standard Library members directly.
Class deque provides:
All of these.
Which of the following applications would a deque not be well suited for?
Applications that require frequent insertions and deletions in the middle of a container.
Which of the following is not a sequence container provided by the Standard Library?
Array.
If pairs is a map containing int keys and double associated values, the expression pairs[ 5 ] = 10:
Associates the value 10.0 to the key 5 in pairs.
The list sequence container does not:
Automatically sort inserted items.
Which of the following are mutating-sequence algorithms defined in the Standard Library?
Both copy and remove_if .
Select the false statement. Container adapters:
Have limited iterator support.
The main difference between set and multiset is:
How they handle duplicate keys.
The multiset associative container does not:
Permit random access to its keys.
Which of the following is not an Standard Library container type?
Second-class containers.
The erase member function of class vector cannot:
Specify a value to be removed from the vector.
Functions iter_swap and swap_ranges are similar in that both:
Take forward iterators as arguments.
Which of the following is a difference between vectors and arrays?
The ability to change size dynamically.
If a program attempts to insert a duplicate key into a set:
The duplicate key will be ignored.
If v1 is a vector< int > containing some number of int elements sorted in ascending order, after these statements execute: std::vector< int > results1; std::vector< int > results2; std::unique_copy( v1.begin(), v1.end(), std::back_inserter( results1 ) ); std::reverse_copy( v1.begin(), v1.end(), std::back_inserter( results2 ) ); which of the following could be true?
The first element in results1 matches the last element in results2.
Which of the following is not a mathematical algorithm included in the Standard Library?
copy.
Which of the following is not a member function of all sequence containers?
middle
Data loss could occur if the contents of a ________ were placed into any of the other three associative container types.
multimap.
Function objects have their functions called by using:
operator().
Which of the following is not a member function of all sequence containers?
push_front
Which of the following bitset member functions cannot be called with an empty argument list?
test
Which of the following bitset member functions cannot be called with an empty argument list?
test.
The expression std::multimap< int, double, std::less< int > >::value_type( 15, 2.7 ):
Creates a pair object in which first is 15 (type int) and second is 2.7 (type double).
Which of the following statements is true of a priority_queue?
Each of its common operations is implemented as an inline function.
Which category of iterators combines the capabilities of input and output iterators into one iterator?
Forward iterators.
Which of the following is the correct hierarchy of iterator categories (weakest at the left)?
Input/output, forward, bidirectional, random access.
The order of the arguments passed to function replace_copy_if must be:
InputIterator, InputIterator, OutputIterator, PredicateFunction, ReplacementValue
Unlike a vector, a deque:
Is not stored in contiguous memory.
Which of the following is not a key component of the Standard Library?
Pointers.
Functions lower_bound, upper_bound and equal_range are different in their:
Return types.
To pop an element off the top of a stack for processing:
Use member function top and then member function pop.
Which bitset function could be used to create the logical not of a bitset object b?
b.flip()
Assuming that bitset b1 contains the bits [0 1 1 0] and bitset b2 contains the bits [1 1 1 1], which of the following expressions returns true?
b1.any()
Part of the functionality of member function ________ can be performed by member function lower_bound.
equal_range
The easiest way to search through a list of names and output the first one that begins with a vowel would be to use function:
find_if
The __________ function would produce the sequence 1, 5, 6 when passed the sequences 1, 2, 3, 4, 5, 6 and 2, 3, 4, 7 as first/second and third/fourth arguments, respectively.
set_difference.
The difference between functions partition and stable_partition is that:
stable_partition maintains the original order for the elements in each of the two resulting partitions with respect to the other elements in that same partition.
Which of the following statements produces identical results as the statement: std::copy( v1.begin(), v1.end(), v2.begin() ); if v1 and v2 are both 10-element vectors?
std::copy_backward( v1.begin(), v1.end(), v2.end() );.
Which of the following function calls would not return the value that is its first argument?
std::max( 'd', 'k' ).
Which of the following containers is not considered a near container?
vectors