11

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

c

A ragged array is: a) a two-dimensional array for which the number of rows is unknown b) a one-dimensional array for which the number of elements is unknown c) a two-dimensional array where the rows are of different lengths d) There is no such thing as a ragged array

length

Each array in Java has a public field named ________ that contains the number of elements in the array. size capacity length limit

b

Given the following two-dimensional array declaration, which statement is TRUE? int [][] numbers = new int [6] [9]; a) The array numbers has 6 columns and 9 rows. b) The array numbers has 6 rows and 9 columns. c) The array numbers has 15 rows. d) The array numbers has 54 rows.

numbers[r].length

If numbers is a two-dimensional array, which of the following would give the length of row r? numbers.length numbers.length[r] numbers[r].length[r] numbers[r].length

b

In order to do a binary search on an array: a) the values of the array must be numeric b) the array must first be sorted in ascending order c) you must first do a sequential search of the array to assure the element you are looking for is there d) there are no requirements

0

Subscript numbering always starts at what value? 0 1 -1 None of these

b

The binary search algorithm: a) is less efficient than the sequential search algorithm b) will cut the portion of the sorted array being searched in half each time c) will have a maximum number of comparisons equal to the number of elements in the array d) will have an average of N/2 comparisons, where N is the number of elements in the array

c

The sequential search algorithm: a) requires the array to be ordered b) must always be implemented as a method c) uses a loop to sequentially step through an array, starting with the first element d) will not execute, if the element is not in the array

94

What is the value of scores[2][3] in the following array? 94 84 93 95

b

What will be returned from the following method? public static float[] getValue(int x) a) A float value b) An array of float values c) An integer d) An array of integers

180

What will be the value of x[8] after the following code has been executed? 170 180 190 200

b

What would be the results after the following code was executed? a) x[] = {36, 78, 12, 24} and y[] = {23, 55, 83, 19} b) x[] = {36, 78, 12, 24} and y[] = {36, 78, 12, 24} c) x[] = {23, 55, 83, 19} and y[] = {23, 55, 83, 19} d) This is a compilation error.

a=5

What would be the results of the following code? a = 5 a = 8 a = 10 This is a compilation error, you cannot compare array elements.

c

What would be the results of the following code? a) Value contains the highest value in array1. b) Value contains the lowest value in array1. c) Value contains the sum of all the values in array1. d) This would cause the program to crash.

d

What would be the results of the following code? a) Value contains the highest value in array1. b) Value contains the lowest value in array1. c) Value contains the sum of all the values in array1. d) This would cause the program to crash.

b

What would be the results of the following code? a) Value contains the highest value in array1. b) Value contains the lowest value in array1. c) Value contains the sum of all the values in array1. d) Value contains the average of the values in array1.

b

Which of the following is a correct method header for receiving a two-dimensional array as an argument? a) public static void passArray(int[2]) b) public static void passArray(int [][]) c) public static void passArray(int[1][2]) d) public static void passArray(int[], int[])

c

Which of the following is a valid declaration for a ragged array? a) int[] ragged = new int[5]; b) int[][] ragged = new int[5][6]; c) int[][] ragged = new int[5][]; d) int[][] ragged = new int[][5];

a

A search algorithm: a) is a way to locate a specific item in a larger collection of data b) is rarely used with arrays c) arranges elements in ascending order d) arranges elements in descending order


Kaugnay na mga set ng pag-aaral

CH: 30 Malignant Hematologic Disorder

View Set

Corticosteroids Review Questions

View Set

Calculating Break Even Points and sale price

View Set

.+*Cloud Computing *+. (The reading and video quiz answers)

View Set

econ chapter 10: public goods and common resources

View Set