CS 111 (Chapter 10)

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

True/False: A vector object automatically expands in size to accommodate the items stored in it

True

This vector function returns the number of elements in a vector

size

This vector function removes an item from a vector

pop_back

What will the following C++ 11 code display? vector<int> numbers { 3,5 }; for (int val: numbers) cout << val << endl;

3 5

What does the following statement do? vector<int> v(10, 2);

It creates a vector object with a starting size of 10 and all elements are initialized with the value 2

This vector function returns true if the vector has no elements

empty

What does the following statement do? vector<int>v(10);

it creates a vector object with a starting size of 10

This vector function is used to insert an item into a vector

push_back

Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20?

vector<int>n{ 10,20 };

Which statement correctly defines a vector object for holding integers?

vector<int>v;


Ensembles d'études connexes

2018 State Entrepreneurship Cluster

View Set

Continued : Chapter 6: Values, Ethics, and Advocacy

View Set

S-130 Module 4 (Potential hazards on the fireline)

View Set

1.2 Price elasticity of Supply (PES)

View Set