|
1 | | If you need to store multiple values for later processing in a program, you can put the list of values in a(n) _______________. |
| | A) | index |
| | B) | list box |
| | C) | array |
| | D) | combo box |
|
|
|
2 | | Each individual variable in an array is called a(n) _______________ of the array. |
| | A) | index |
| | B) | subscript |
| | C) | element |
| | D) | series |
|
|
|
3 | | The position of an element within an array is referenced by the _______________ or index inside the brackets. |
| | A) | symbol |
| | B) | button |
| | C) | control |
| | D) | subscript |
|
|
|
4 | | You must specify the number of elements that will be in an array in the _______________ statement. |
| | A) | declaration |
| | B) | looping |
| | C) | comment |
| | D) | initialization |
|
|
|
5 | | Which of the following statements creates an array named booksString and allows storage of 15 string variables in the array? |
| | A) | string[] booksString[15]; |
| | B) | booksString = new string[15]; |
| | C) | string[] booksString[15] = new string[15]; |
| | D) | string[] booksString = new string[15]; |
|
|
|
6 | | Which of the following statements creates an array named bookTypesString and allows storage of these 3 items in the array: "Fiction", "NonFiction", and "Periodical"? |
| | A) | string[] bookTypesString = new { "Fiction", "NonFiction", "Periodical"}; |
| | B) | string[] bookTypesString = new string[] { "Fiction", "NonFiction", "Periodical"}; |
| | C) | string[] bookTypesString = { "Fiction", "NonFiction", "Periodical"}; |
| | D) | string[] bookTypesString = new string[3] { "Fiction", "NonFiction", "Periodical" |
|
|
|
7 | | Which of the following subscripts can be used to reference the third element in an array that is declared with the statement int[] valueInteger = new int[5]; ? |
| | A) | 0 |
| | B) | 1 |
| | C) | 2 |
| | D) | 3 |
|
|
|
8 | | What type of looping construct should be used when you do not want to manipulate the subscripts of an array? |
| | A) | for |
| | B) | foreach |
| | C) | do |
| | D) | do/while |
|
|
|
9 | | What statement can be used to exit a foreach loop early? |
| | A) | break |
| | B) | exit |
| | C) | end |
| | D) | halt |
|
|
|
10 | | The variable used in a foreach statement should be declared at the_____________. |
| | A) | class-level |
| | B) | module-level |
| | C) | block-level |
| | D) | none of these |
|
|