C++ Vectors Review

C++ Vectors Review

9th - 12th Grade

16 Qs

quiz-placeholder

Similar activities

Vector Images

Vector Images

9th - 10th Grade

14 Qs

Unity Quiz

Unity Quiz

10th - 12th Grade

15 Qs

Unity Game Developer

Unity Game Developer

10th - 12th Grade

15 Qs

Vector Graphics

Vector Graphics

9th - 12th Grade

20 Qs

DGAI - Strand 6 General Computer Function

DGAI - Strand 6 General Computer Function

9th - 12th Grade

18 Qs

Initialization Vector (IV) Attack

Initialization Vector (IV) Attack

11th Grade

11 Qs

Vectors - Data Structures - Starter Quiz

Vectors - Data Structures - Starter Quiz

11th - 12th Grade

17 Qs

Friday Jan 24 Quiz

Friday Jan 24 Quiz

9th - 12th Grade

20 Qs

C++ Vectors Review

C++ Vectors Review

Assessment

Quiz

Computers

9th - 12th Grade

Easy

Created by

Ferhat Travaci

Used 12+ times

FREE Resource

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is true about vectors?

Vectors allow you to store multiple values in a single variable

Vectors can only hold one type of value

Vectors are dynamic and can grow in size

All of the other options are true

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a correct way to create a vector?

vector<string> greeting {"Hello", "Hola"};

vector<int> nums {3, 6, 7.8, 9};

vector<bool> option {true};

All of the options are correct

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be printed from the following code snippet?

vector<string> count {"One", "Two", "Three"};

cout << count.at(1) << endl;

cout << count[2] << endl;

1

2

One

Two

Two

Three

Three

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement best describes the actions of the push_back command?

push_back adds a new element to the front of the vector, pushing all of the elements back 1 index and increasing the overall size by 1.

push_back adds a new element to the end of the vector, increasing the size by 1.

push_back replaces the first element in the vector.

push_back replaces the last element in the vector.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code segment return?

vector<string> lang {"C++", "Java", "Python", "JavaScript"};

cout << lang.at(lang.size() - 2) << endl;

C++

Java

Python

JavaScript

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will print from the following code snippet?

vector<double> constants {3.14, 2.718, 0.577};

constants.pop_back();

constants.push_back(constants.size());

cout << constants[2] << endl;

2

3

2.718

0.577

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Which of the following code segments will print all members of an int vector v?

1 only

2 only

Neither 1 or 2

Both 1 and 2

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?