Ch 7 Arrays

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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

3 5

What is the last legal subscript that can be used with the following array?int values[5];

4

What will the following code display? int numbers[] = {99, 87, 66, 55, 101}; cout << numbers[3] << endl;

55

What does the following code do? const int SIZE = 5; double x[SIZE]; for (int i = 2; i <= SIZE; i++) { x[i] = 0.0; }

An error will occur when the code runs.

An array can easily be stepped through by using a

for loop

An array with no elements is

illegal in C++

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

push_back

In C++11 the range-based for loop is best used in situations where you need the element subscript for some purpose.

False

Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function.

False

An array initialization must be all on one line.

False

A vector object automatically expands in size to accommodate the items stored in it.

True

An individual array element can be processed like any other type of C++ variable.

True

Each individual element of an array can be accessed by the array name and the element subscript.

True

An array's size declarator must be a ________ with a value greater than ________.

constant INTEGER expression, zero

A(n) ________ can be used to specify the starting values of an array.

initialization list

Arrays must be ________ at the time they are ________.

initialized, declared

Which of the following is a valid C++ array definition?

int sizes[10];

The ________ is automatically appended to a character array when it is initialized with a string constant.

null terminator

An array can store a group of values, but the values must be

the same data type

Which statement correctly defines a vector object for holding integers?

vector<int> v;


Set pelajaran terkait

Chapter 1 Questions: Basic insurance concepts and principals

View Set

Ch 15 - Growth Motivation & Positive Motivation

View Set

DNR biosintezės bendrieji bruožai

View Set

Intro to Financial Accounting Chapter 1 (Introduction to Financial Statements)

View Set