CPS120 Name ______

Worksheet 11: Arrays

1.  (True/False) You must declare an array in order to access individual values within the array.

2.  (True/False) Initializing an array is the same thing as declaring an array.

3.  (True/False) If an array is declared with ten elements, the elements have index (subscript) positions 1 through ten.

4.  (True/False) C++ allows you to declare arrays of structures.

5.  (True/False) Each variable in an array is called an index.

6.  Write a statement that declares an array of doubles named scores with 10 elements.

7.  Write a statement that declares an array of integers named temperatures with 5 elements.

8.  Write a statement that declares an array named numbers and initialize its with the values 23, 14, 2, 85, 0, 3 (in this order).

9.  Write a statement that will set the third element of an array named scores to the value 34.3.

10.  Write a statement that will displays the value of the eighth element of the array temperatures to the screen.

11.  Write a program that declares a one-dimensional array of ten integer elements named sums. Using a for loop, assign the value 10 to each element of sums.

12.  (True/False) The five-dimensional array is the most common type of multi-dimensional array.

13.  (True/False) When identifying the row and column positions of an array, the first argument stands for the row and the second argument for columns.

14.  (True/False) If baseballBoxScore is a two-dimensional array with 2 rows and 10 columns, the statement cout < baseballBoxScore;will neatly display the array as a table with 2 rows and 10 columns.

15.  (True/False) The statementint baseballBoxScore[2][2];declares a two-dimensional array with 4 elements.

16.  Write a program that allows the user to enter five integers that are stored into an array named list. Also, use a loop to find and display the sum of the elements in the array.

arrays_ws11 Arrays Worksheet Page 1 of 3