INFO-I210 Quiz 6
Subscripting always starts with ________.
0
What would be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5};
An array of 6 values, ranging from 0 through 5 and referenced by the variable x will be created.
Given the following two-dimensional array declaration, which statement is true? int[][] numbers = new int[6][9];
The numbers array has 6 rows and 9 columns.
What would be the result after the following code is executed? int [ ] numbers = { 50, 10, 15, 20, 25, 100, 30 }; int value = 0; for ( int i = 1, i < numbers.length; i++ ) value += numbers [ i ];
The value variable will contain the sum of all the values in the numbers array.
A ragged array is ________.
a two-dimensional array where the rows have different numbers of columns
What will be the results after the following code is executed? int[ ] x = { 55, 33, 88, 22, 99, 11, 44, 66, 77 }; int a = 10; if ( x [2] > x [5] ) a = 5; else a = 8;
a=5
A search algorithm ________.
is used to locate a specific item in a collection of data
Each array in Java has a public field named ________ that contains the number of elements in the array.
length
If numbers is a two-dimensional array, which of the following would give the number of columns in row r?
numbers[r].length
Which of the following is a correct method header for receiving a two-dimensional array as an argument?
public static void passMyArray(int[][])
The ________ method removes an item from an ArrayList at a specific index.
remove
In order to do a binary search on an array ________.
the array must first be sorted
T or F- Declaring an array reference variable does not create an array.
true
The sequential search algorithm ________.
uses a loop to sequentially step through an array, starting with the first element
T or F- Once an array is created, its size cannot be changed.
true
T or F- To determine if two arrays are equal you must compare each of the elements of the two arrays.
true
If final int SIZE = 15 and int[] x = new int[SIZE], what would be the range of subscript values that could be used with x[]?
0 through 14
What is the value of scores[2][3] in the following array? int [ ] [ ] scores = { { 88, 80, 79, 92 }, { 75, 84, 93, 80 }, { 98, 95, 92, 94 }, { 91, 84, 88, 96 } } ;
94
T or F- A sorting algorithm is used to locate a specific item in a larger collection of data.
false
T or F- An array can hold multiple values of several different types of data simultaneously.
false