22. After the first pass in a typical ascending value bubble sort, what best describes the last element in an array?
23. What is a group of related variables that have the same data type?
24. What value is a subscript assigned to access the first element in a one-dimensional array?
25. Which of the following statements declares a one-dimensional array containing two integer values?
int numbers[3] = {1, 2, 3};
char letters[2] = {‘a’, ‘b’};
int characters[2] = {45, 87};
26. Given the following code, which statement displays each element of the array, one line at a time?
char myArray[4] = {‘a’, ‘b’, ‘c’, ‘d’};
for (int i = 0; i < 4; i += 1)
—- code goes here —-
cout >> myArray[i] >> endl;
cout << myArray[i] << endl;
cout << myArray[4] << endl;
27. What are the most commonly used arrays in business applications?
one-dimensional arrays only
two-dimenstional arrays only
one-dimensional and two dimensional arrays
multi-dimensional arrays (3 or more dimensions)
28. What, if anything, is needed to fix the following code so that the elements of the array are printed, one line at a time?
char myArray[4] = {‘a’, ‘b’, ‘c’, ‘d’};
for (int i = 1; i < 4; i += 1)
cout << myArray[i] << endl;
change the loop comparison to i <= 3
change the array declaration to myArray[3]
nothing needs to be changed
change the initial value of i
29. Which type of sort provides a quick and easy way to sort the items stored in an array, as long as the number of items is
relatively small?
30. With one-dimensional arrays, what indicates the variable’s position within the array?
31. How can the code in the following example best be described?
int scoreThreshold[4] = {90, 80, 70, 60};