1. (TCO 11) Which of the following is false? (Points : 3)
All elements of the array have the same data type.
All elements in an array have the same name.
All elements in an array have the same subscript.
The first element of the array has a subscript of zero.

2. (TCO 11) Programmers often mistakenly reference the first element in an array with index1. What is this called? (Points : 3)
Logic-error
Index1-error
off-by-one-error
N-1

3. (TCO 11) A five-row, six-column array has a total of how many elements? (Points : 3)
1
36
30
11

4. (TCO 12) Given the following array:

int profit  = {10, 20, 31, 55, 66};

The following statement would replace which value?
profit  = profit; (Points : 3)
10 with 31
10 with 20
20 with 31
10 with 55

5. (TCO 12) What is the character automatically included at the end of an array of characters? (Points : 3)
\n
\0
\z
\*

6. (TCO 11) In the following array, what is the value of table?
int table={0,7,3,2,4,9,8,1,3,6,5,4};
(Points : 3)
3
2
1
0

7. (TCO 11) What type of error will this code produce?

int n, i;
for(i = 0; i <= 30; ++i)
n[i] = i; (Points : 3)
No compiler errors will be reported.
A compiler error is generated since there are no braces {} with the for loop.
A runtime error may occur because we are out of bounds on the array.
No compiler errors will be reported, but a runtime error may occur because we are out of bounds on the array.

8. (TCO 11) Is it possible to write code in this manner for a C++ program?

#define size 20
int main()
{
int numbers[size];
} (Points : 3)
Yes, this is perfectly acceptable C++ code.
No, the array dimension cannot be a variable.
Yes, you could write it this way, but you would be wrong.
None of the above

9. (TCO 11) Given this function prototype void CalcTotal(float numbers[]), what is wrong with this function?

void CalcTotal(float numbers) {
float total;
for(int I = 0; I < 6 ++I)
{
total = total + numbers[I];
}
} (Points : 3)
The function is correct.
There is a data type in the function header line.
I is capitalized.
The function header line doesn't match the prototype.

10. (TCO 12) Which is not a reason pointers are valuable? (Points : 3)
Pointers allow for faster access to array elements.
Pointers speed the process of passing objects like classes to functions.
Pointers allow function to be passed as an argument to other functions.
Pointers involve a great deal of overhead when used in conjunction with arguments.

11. (TCO 11) Explain how to determine the number of elements in a previously defined single-dimension array. Provide a C++ program segment that illustrates your answer. (Points : 5)

## Write a review  