CMPSC 201 - Arrays Worksheet #2 Name -

1. (True/False) The five-dimensional array is the most common type of multi-dimensional array.
2. (True/False) C++ will only allow you to declare five-dimensional or smaller arrays.
3. (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.
4. (True/False) If boxScore is a two-dimensional array with 2 rows and 10 columns, the statement    cout << boxScore;   will neatly display the array as a table with 2 rows and 10 columns.
5. (True/False) The statement    int boxScore[2][2];    declares a two-dimensional array with 4 elements.

6. Write a statement that declares a two-dimensional array of floating-point values named grades with 5 rows and 3 columns.

 

7. Write a statement that declares a two-dimensional array of integers named days with 12 rows and 31 columns and that initializes all elements of the array with the value zero.

 

8. Write an assignment statement that assigns the value 100 to the element in the first row and first column of the array named grades.

 

9. Write an assignment statement that assigns the value 85 to the element in the second row and third column of the array named grades.

 

10. Write an assignment statement that computes the sum of the element in the first row and first column with the element in the second row and third column and then assigns that sum to the element in the fourth columns and fifth row.