| CMPSC 101 - array worksheet #1 | Name - |
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 10.
4. (True/False) C++ allows you to declare arrays of integers.
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 and efficiently initializes each element to the value 0.
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 assign 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 an array of ten integer elements named sums. Using a for loop, assign the value 10 to each element of sums.
12. Write a program that allows the user to enter five integers which are stored into an array named list. Also, use a loop to find and display the sum of the elements in the array.