Quiz 7

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

rows, columns

A two-dimensional array can be viewed as ________ and ________.

one

A two-dimensional array can have elements of ________ data type(s).

several identical arrays

A two-dimensional array is like ________ put together.

strings of the same length strings of different lengths uninitialized elements

A two-dimensional array of characters can contain ________.

initialization list

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

null terminator

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

elements

The individual values contained in array are known as ________.

memory address

The name of an array stores the ________ of the first array element.

range variable

The range-based for loop, in C++ 11, is designed to work with a built-in variable known as the ________.

implicit array sizing

The statement: int grades[] = {100, 90, 99, 80} is an example of:

It creates a vector object with a starting size of 10.

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

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

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

4

What is the last legal subscript that can be used with the following array?

3 5

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

55

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

87 66 55

What will the following code display? int numbers[] = {99, 87, 66, 55, 101} for (int i = 1; i < 4; i++) cout << numbers[i] << endl;

0

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

an error will occur when the code runs

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

all but the first dimension

When writing functions that accept multi-dimensional arrays as arguments, ________ must be explicitly stated in the parameter list.

int array[10];

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

int scores[10];

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

vector <int> v;

Which statement correctly defines a vector object for holding integers?

vector <int> n{10,20};

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

for loop

An array can easily be stepped through by using a ________.

the same data type

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

string names[5];

An array of string objects that will hold 5 names would be declared using which statement?

illegal in C++

An array with no elements is ________.

constant integer expression, zero

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

the row subscript of the element, the column subscript of the element

An element of a two-dimensional array is referred to by ________ followed by ________.

initialized, declared

Arrays may be ________ at the time they are ________.

subscript

By using the same ________ you can build relationships between data stored in two or more arrays.

scores[2]

Given the following declaration, where is the value 77 stored in the scores array? int scores[] = {83, 62, 77, 97};

1000

How many elements does the following array have? int bugs[1000];

you must furnish a initialization list

If you leave out the size declarator in an array definition:

legal in C++

It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3].

begins with zero

Subscript numbering in C++________.

push_back

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

pop_back

This vector function removes an item from a vector.

size

This vector function returns the number of elements in a vector.

empty

This vector function returns true if the vector has no elements.

subscript

To access an array element, use the array name and the element's ________.

a loop to assign the elements of one array to the other array

To assign the contents of one array to another, you must use ________.

name

To pass an array as an argument to a function, pass the ________ of the array.

False

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

False

True/False: An array initialization list must be placed on one single line.

False

True/False: If you attempt to store data past an array's boundaries, it is guaranteed that the compiler will issue an error.

True

True/False: In C++ 11, you cannot use a range-based for loop to modify the contents of an array unless you declare the range variable as a reference.

True

True/False: The amount of memory used by an array depends upon the array's data type and the number of elements in the array.

True

True/False: When you pass an array as an argument to a function, the function can modify the contents of the array.

arrays

Unlike regular variables, these can hold multiple values.


Kaugnay na mga set ng pag-aaral

Загальна патологія (екзамен-крок)

View Set

Managerial Leadership | Chapter 3 - Skills Approach

View Set

Module 41: Anxiety disorders, OCD, and PTSD

View Set