Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

bbhosted cunyadu Take Test: Quz QUESTION 1 H final int SIZE O 0 through 14 15 an

ID: 3728322 • Letter: B

Question

bbhosted cunyadu Take Test: Quz QUESTION 1 H final int SIZE O 0 through 14 15 and int[] new int[SI2E], what would be the range of subsoript values that could be used with x11? 1 through 14 O 1 through 15 O 0 through 15 QUESTION 2 The sequential search algorithm: O must always be implemented as a method O uses a loop to sequentially step through an array, starting with the first element O will not esxecute, if the element is not in the array requires the array to be ondered QUESTION 3 What will be the value of x(81 after the following code has beon executed? final int SUB-12 int t] x-nev int [SUB]; int y 100 y 10 190 180 200 170 QUESTION 4 When an array is passed to a method a reference to the array is passed t is passed just as an object Cick Sove and Submit to save and submit, Cick Save All.Auers to sove all anseers

Explanation / Answer

1)Option A

Final variables in java means Once the value to the variable

has been assigned, it always contains the same value.

Here SIZE will be initialized to 15 and the range of

subscript is 0 to 14 (15 values).

Hence Option A is correct.


2)Option B

Sequential search algorithm uses a loop to sequentially step through

an array, starting with the first element.

  Hence Option B is correct.


3)Option B

Here SUB = 12 and hence subscript of x is from 0 to 11.

Here y = 100.

when i = 0 , x[0] = 100 and y = 110.

i = 1 , x[1] = 110 and y = 120.

i = 2 , x[2] = 120 and y = 130.

i = 3 , x[3] = 130 and y = 140.

i = 4 , x[4] = 140 and y = 150.

i = 5 , x[5] = 150 and y = 160.

i = 6 , x[6] = 160 and y = 170.

i = 7 , x[7] = 170 and y = 180.

i = 8 , x[8] = 180 and y = 190.

Hence x[8] = 180.

Hence Option B is correct.

4)Option D

When an array is passed to a method a reference to an array is passed.
When an array is passed to a method it is passed just as an object.
When an array is passed to a method the method has direct access to the original array.

Hence all are correct.


5)Option A

Partially-filled array is used to accompanying integer value

that holds the number of items stored in the array.

Hence Option A is correct.


6)Option D

length is used for finding array size.

length() is used to finding string size.

Hence Option D is correct.


7)Option D

Java performs array bounds checking which means that it does not allow a statement

to use a subscript that is outside the range of valid subscripts for the array.

Hence Option D is correct.


8)Option B

In order to do a binary search on an array the array must

first be sorted in ascending order.

Hence Option B is correct.


9)Option A

numberItems is used to determine the number of items

stored in an ArrayList object.

Hence Option A is correct.


10)Option A

Here x[2] is 88 and x[5] is 11 and

88 > 11 is true and Hence a = 5;

Hence Option A is correct.