Filters
Question type

Study Flashcards

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


A) the assignment operator with the array names
B) the equality operator with the array names
C) a loop to assign the elements of one array to the other array
D) Any of these
E) None of these

F) A) and D)
G) None of the above

Correct Answer

verifed

verified

An array initialization must be all on one line.

A) True
B) False

Correct Answer

verifed

verified

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


A) array name
B) number of elements
C) value of the first element
D) null terminator
E) None of these

F) A) and C)
G) B) and E)

Correct Answer

verifed

verified

D

An array of string objects that will hold five names would be declared with which of the following statements?


A) string names[5];
B) string names(5) ;
C) string names 5;
D) String[5] = names;

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

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


A) vector n<int>(10, 20) ;
B) vector<int> n = {10, 20};
C) vector<int> n {10, 20};
D) int vector n ({10}, {20}) ;

E) All of the above
F) C) and D)

Correct Answer

verifed

verified

The following statement is a valid C++ definition: double money[25.00];

A) True
B) False

Correct Answer

verifed

verified

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 variable.

A) True
B) False

Correct Answer

verifed

verified

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


A) the array name followed by the column number of the element
B) the row subscript of the element followed by the column subscript of the element
C) a comma followed by a semicolon
D) the row subscript of the element followed by the array name
E) None of these

F) A) and D)
G) A) and E)

Correct Answer

verifed

verified

B

If you leave out the size declarator in an array definition


A) you must furnish an initialization list
B) you are not required to initialize array elements
C) all array elements default to zero values
D) your array will contain no elements
E) None of these

F) C) and D)
G) A) and B)

Correct Answer

verifed

verified

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


A) 0
B) 5
C) 6
D) 4
E) 1

F) A) and E)
G) A) and C)

Correct Answer

verifed

verified

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


A) insert_item
B) add_item
C) store
D) push_back

E) B) and D)
F) B) and C)

Correct Answer

verifed

verified

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


A) the same data type
B) integers and floating-point numbers
C) integers
D) constants
E) None of these

F) C) and D)
G) B) and C)

Correct Answer

verifed

verified

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


A) contents
B) size, expressed as an integer
C) name
D) value of the first element
E) None of these

F) B) and E)
G) B) and D)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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


A) one
B) two
C) four
D) any number of
E) None of these

F) A) and B)
G) A) and C)

Correct Answer

verifed

verified

What does the following code do? Const int SIZE = 5; Double x[SIZE]; For (int i = 2; i <= SIZE; i++) { X[i] = 0.0; }


A) Each element in the array is initialized to 0.0.
B) Each element in the array except the first is initialized to 0.0.
C) Each element in the array except the first and last is initialized to 0.0.
D) An error will occur when the code runs.

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

D

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


A) has_no_elements
B) null_size
C) empty
D) is_empty

E) B) and C)
F) A) and B)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

C++ limits the number of array dimensions to two.

A) True
B) False

Correct Answer

verifed

verified

The individual values contained in an array are known as


A) parts
B) items
C) constants
D) elements
E) None of these

F) C) and E)
G) C) and D)

Correct Answer

verifed

verified

Showing 1 - 20 of 56

Related Exams

Show Answer