• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 6 pages
Exam (elaborations)

CISP 400 - Chapter 15 Standard Library Containers and Iterators

Document preview thumbnail
Preview 2 out of 6 pages

CISP 400 - Chapter 15 Standard Library Containers and Iterators

Content preview

CISP 400 - Chapter 15 Standard Library
Containers and Iterators
An STL algorithm cannot:
Be used with containers that support more powerful iterators than the minimum
requirements for the algorithm.
Return an iterator.
Access STL members directly.
Take two iterators as arguments to specify a range. - ANSWER-

Attributes of a heap do not include:
- A preference to pop, rather than push, elements in the heap.
- Having a binary-tree structure.
- The children of a given node are less than or equal to the parent node's value.
- Having the largest element at the top of the heap. - ANSWER-

Class deque provides:
- The ability to add storage at either end of the deque.
*- All of the above.
- Efficient indexed access to its elements.
- Efficient insertion and deletion operations at the front and back of a deque. -
ANSWER-

Data loss could occur if the contents of a __________ were placed into any of the other
three associative container types.
*- multimap.
- map.
- multiset.
- set. - ANSWER-

Function objects have their functions called by using:
- The arrow operator (->).
- The binary scope resolution operator (::).
*- operator().
- The dot operator (.). - ANSWER-

Functions iter_swap and swap_ranges are similar in that both:
*- Take forward iterators as arguments.
- Swap a range of elements
- Take two arguments.
- Can only swap elements within the same array or container. - ANSWER-

Functions lower_bound, upper_bound and equal_range are different in their:
- First argument types.

, - Second argument types.
- Third argument types.
*- Return types. - ANSWER-

Given that v1 and v2 are vectors, the function call std::equal( v1.begin(), v1.end(),
v2.begin() ) returns:
- A bool indicating whether the first element of v1, the last element of v1 and the first
element of v2 are all equal.
*- A bool indicating whether v1 and v2 are equal.
- An iterator pointing to the first location where v1 and v2 are not equal.
- An iterator pointing to the first location where v1 and v2 are equal. - ANSWER-

If a program attempts to insert a duplicate key into a set:
- The set will contain multiple copies of that key.
- A compile error will occur.
- An exception is thrown
*- The duplicate key will be ignored. - ANSWER-

If pairs is a map containing int keys and double associated values, the expression pairs[
5 ] = 10:
- Associates the value associated with key 10 to key 5 in pairs.
- Associates the value 5.0 to the key 10 in pairs.
- Associates the value associated with key 5 to key 10 in pairs.
*- Associates the value 10.0 to the key 5 in pairs. - ANSWER-

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?
- results1 is empty but results2 is not.
- results1 contains more elements than results2.
- None of the above.
*- The first element in results1 matches the last element in results2. - ANSWER-

Iterators are similar to pointers because of the:
begin and end functions.
* * and ++ operators.
-> operator.
& operator. - ANSWER-

Mr. Smith has a shopping list stored in a vector. Today, Mrs. Smith decides that she will
go get the items that cost less than 10 dollars. If Mr. Smith wants to give his wife a list of
her own, he should use the function:

Document information

Uploaded on
September 20, 2024
Number of pages
6
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$11.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
CLOUNDLite
4.0
(131)
Sold
665
Followers
389
Items
12415
Last sold
6 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions