• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 6 páginas
Examen

CISP 400 - Chapter 15 Standard Library Containers and Iterators

Document preview thumbnail
Vista previa 2 fuera de 6 páginas

CISP 400 - Chapter 15 Standard Library Containers and Iterators

Vista previa del contenido

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:

Información del documento

Subido en
20 de septiembre de 2024
Número de páginas
6
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$11.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
CLOUNDLite
4.0
(131)
Vendido
665
Seguidores
389
Artículos
12415
Última venta
1 semana hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes