Quiz 7 C++

Ace your homework & exams now with Quizwiz!

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

The correct answer is: legal in C++

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

The correct answer is 'False'.

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

The correct answer is 'False'.

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

The correct answer is: you must furnish an initialization list

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

The correct answer is 'False'.

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.

The correct answer is '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.

The correct answer is 'True'.

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

The correct answer is 'True'.

What will the following code display?

The correct answer is: 0

How many elements does the following array have?

The correct answer is: 1000

What will the following C++ 11 code display?

The correct answer is: 3 5

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

The correct answer is: 4

What will the following code display?

The correct answer is: 55

What will the following code display?

The correct answer is: 87 66 55

A two-dimensional array of characters can contain ________.

The correct answer is: All of these

What will the following code do?

The correct answer is: An error will occur when the code runs

What does the following statement do?

The correct answer is: 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?

The correct answer is: It creates a vector object with a starting size of 10.

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

The correct answer is: a loop to assign the elements of one array to the other array

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

The correct answer is: all but the first dimension

Unlike regular variables, these can hold multiple values.

The correct answer is: arrays

Subscript numbering in C++________.

The correct answer is: begins with zero

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

The correct answer is: constant integer expression, zero

The individual values contained in array are known as ________.

The correct answer is: elements

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

The correct answer is: empty

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

The correct answer is: for loop

An array with no elements is ________.

The correct answer is: illegal in C++

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

The correct answer is: implicit array sizing

ANo ________ can be used to specify the starting values of an array.

The correct answer is: initialization list

Arrays may be ________ at the time they are ________.

The correct answer is: initialized, declared

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

The correct answer is: int array[10];

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

The correct answer is: int scores [10];

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

The correct answer is: memory address

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

The correct answer is: name

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

The correct answer is: null terminator

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

The correct answer is: one

This vector function removes an item from a vector.

The correct answer is: pop_back

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

The correct answer is: push_back

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

The correct answer is: range variable

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

The correct answer is: rows, columns

Given the following declaration, where is the value 77 stored in the scores array?

The correct answer is: scores[2]

A two-dimensional array is like ________ put together.

The correct answer is: several identical arrays

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

The correct answer is: size

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

The correct answer is: string names[5];

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

The correct answer is: subscript

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

The correct answer is: subscript

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

The correct answer is: the row subscript of the element, the column subscript of the element

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

The correct answer is: the same data type

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

The correct answer is: vector<int> n { 10, 20 };

Which statement correctly defines a vector object for holding integers?

The correct answer is: vector<int> v;


Related study sets

Ch. 25 Management of Patients with Complications of Heart Disease

View Set

Section 16: Real Estate Financing Basics

View Set

The Inner Man: Chapter 28 - Searching Test to Leadership

View Set

AP Human Geography: Language family

View Set

More About Linear Equations Quiz

View Set

Chapter 16 The Autonomic Nervous System and Higher-Order Functions

View Set