Given that String[ ] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the following statement: |
str[0].toUpperCase( ); |
Which of the following is a valid declaration for a ragged array, after which you would declare each row? |
C. int[ ][ ] ragged = new int[5][ ]; |
If numbers is a two-dimensional array, which of the following would give the length of row r? |
numbers[r].length |
What would be the results of the following code? final int SIZE = 25; … // Code that will put values in array1 int value = 0; |
value contains the highest value in array1 |
T or F: An ArrayList object automatically expands in size to accommodate the items stored in it. |
True |
Which of the following is a correct method header for receiving a two-dimensional array as an argument? |
B. public static void passArray(int [ ][ ] intArray) |
T or F: Java limits the number of dimensions that an array may have to 15. |
False |
What will be the value of x[8] after the following code has been executed? final int SUB = 12; |
180 |
The ArrayList class is in this package. |
java.util |
What will be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5}; A. An array of 6 values ranging from 0-5 and referenced by the variable x will be created |
A. An array of 6 values ranging from 0-5 and referenced by the variable x will be created |
What does the following statement do? double[] array1 = new double[10]; A. Declares array1 to be a reference to an array of double values |
D. All of these |
T or F: If a[ ] and b[ ] are two integer arrays, the expression a == b compares the array contents. |
False |
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 |
You can use this ArrayList class method to insert an item at a specific location in an ArrayList. |
add |
You can use this ArrayList class method to replace an item at a specific location in an ArrayList. |
add??? |
What will be the results of the following code? final int ARRAY_SIZE = 5; |
An error will occur when the program runs |
The following statement creates an ArrayList object. What is the purpose of the <String> notation? ArrayList<String> arr = new ArrayList<String>( ); A. It specifies that only String objects may be stored in the ArrayList object |
A. It specifies that only String objects may be stored in the ArrayList object |
How many rows and how many columns are in the points array, declared here: int [ ][ ] points = new int[10][20]; |
10 rows and 20 columns |
The sequential search algorithm: |
Uses a loop to sequentially step through an array, starting with the first element |
T or F: When an array of objects is declared, but not initialized, the array values are set to null. |
True |
A ragged array is: |
A two-dimensional array when the rows are of different lengths |
T or F: Any items typed on the command-line, separated by space, after the name of the class are considered to be one or more arguments that are to be passed into the main method. |
True |
T or F: To compare the contents of two arrays, you must compare the elements of the two arrays. |
True |
T or F: The purpose of the sequential search algorithm is to rearrange the elements of an array so they appear in order from the lowest value to the highest value. |
False |
A search algorithm: |
Is a way to locate a specific item in a larger collection of data |
Ch 7- Arrays and the ArrayList Class
Share This
Unfinished tasks keep piling up?
Let us complete them for you. Quickly and professionally.
Check Price