1) Unlike regular variables, these can hold multiple values. |
C |
2) The individual values contained in array are known as ________. |
B |
3) To access an array element, use the array name and the element’s ________. |
B |
4) Which of the following is a valid C++ array definition? |
D |
5) The statement: int grades[ ] = { 100, 90, 99, 80}; shows an example of: |
D |
6) By using the same ________ you can build relationships between data stored in two or more arrays. |
C |
7) The name of an array stores the ________ of the first array element. |
A |
8) A two-dimensional array is like ________ put together. |
B |
9) A two-dimensional array can be viewed as ________ and ________. |
A |
10) If you leave out the size declarator in an array definition: |
A |
11) Which of the following is a valid C++ array definition? |
D |
12) An element of a two-dimensional array is referred to by ________ followed by ________. |
B |
13) When writing functions that accept multi-dimensional arrays as arguments, ________ must be explicitly stated in the parameter list. |
B |
14) An array can store a group of values, but the values must be: |
A |
15) An array’s size declarator must be a ________ with a value greater than ________. |
C |
16) Subscript numbering in C++________. |
D |
17) Arrays may be ________ at the time they are ________. |
C |
18) Given the following declaration, where is the value 77 stored in the scores array? int scores[] = {83, 62, 77, 97}; A) scores[0] |
C |
19) An array can easily be stepped through by using a ________. |
A |
20) The range-based for loop, in C++ 11, is designed to work with a built-in variable known as the ________. |
D |
21) To assign the contents of one array to another, you must use ________. |
C |
22) To pass an array as an argument to a function, pass the ________ of the array. |
C |
23) A two-dimensional array can have elements of ________ data type(s). |
A |
24) A two-dimensional array of characters can contain ________. |
D |
25) A(n) ________ can be used to specify the starting values of an array. |
A |
26) The ________ is automatically appended to a character array when it is initialized with a string constant. |
D |
27) An array with no elements is ________. |
B |
28) An array of string objects that will hold 5 names would be declared using which statement? |
A |
29) It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3]. |
B |
30) What is the last legal subscript that can be used with the following array? int values[5]; A) 0 |
D |
31) How many elements does the following array have? int bugs[1000]; A) 1000 |
A |
32) What will the following code display? int numbers[] = {99, 87, 66, 55, 101 }; A) 55 |
A |
33) What will the following code display? int numbers[] = { 99, 87, 66, 55, 101 }; A) 99 B) 87 C) 87 D) Nothing. This code has an error. |
C |
34) What will the following code display? int numbers[4] = { 99, 87 }; A) 87 |
B |
35) What will the following code do? const int SIZE = 5; A) Each element in the array is initialized to 0.0 |
D |
36) Which statement correctly defines a vector object for holding integers? |
D |
37) Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20? |
C |
38) What does the following statement do? vector<int> v(10); A) It creates a vector object and initializes all of its elements to the value 10. |
B |
39) What will the following C++ 11 code display? vector<int> numbers { 3, 5 }; for (int val : numbers) A) 5 B) 3 C) 3 D) Nothing. This code has an error. |
C |
40) What does the following statement do? vector<int> v(10, 2); A) It creates a vector object and initializes all the first two elements with the values 10 and 2. |
D |
41) This vector function is used to insert an item into a vector. |
D |
42) This vector function returns the number of elements in a vector. |
A |
43) This vector function removes an item from a vector. |
D |
44) This vector function returns true if the vector has no elements. |
C |
1) 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 |
2) True/False: The statement: double money[25.00]; is a valid C++ array definition. |
FALSE |
3) True/False: An array initialization list must be placed on one single line. |
FALSE |
4) True/False: Assume array1 and array2 are the names of arrays. To assign the contents of array2 to array1, you would use the following statement. array1 = array2; |
FALSE |
5) True/False: When you pass an array as an argument to a function, the function can modify the contents of the array. |
TRUE |
6) True/False: C++ limits the number of array dimensions to two. |
FALSE |
7) True/False: If you attempt to store data past an array’s boundaries, it is guaranteed that the compiler will issue an error. |
FALSE |
8) True/False: An individual array element can be processed like any other type of C++ variable. |
TRUE |
9) 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 |
10) True/False: In C++ 11, the range-based for loop is best used in situations where you need the element subscript for some purpose. |
FALSE |
11) True/False: Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function. |
FALSE |
12) True/False: Each individual element of an array can be accessed by the array name and an element number, called a subscript. |
TRUE |
13) True/False: If an array is partially initialized, the uninitialized elements will be set to zero. |
TRUE |
14) True/False: A vector object automatically expands in size to accommodate the items stored in it. |
TRUE |
CSCI Ch 7
Share This
Unfinished tasks keep piling up?
Let us complete them for you. Quickly and professionally.
Check Price