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

QUESTION 1 Answer questions based on the following code: int[] x = new int [10];

ID: 3588970 • Letter: Q

Question

QUESTION 1

Answer questions based on the following code:

int[] x = new int [10];

1. x is a reference variable to an array. Its dimension is _____. (use numeric value)

2. x.length has a value of _____. (use numeric value)

3. The array stores ______ values of ______ type. (numeric value for first; case sensitive Java type for second)

4. The first element, x[___], is initialized to ____. (numeric values)

5. The index to the last element is ____. (numeric value)

QUESTION 2

After the following code finishes executing, the variable result has a value of ___. (numeric value)

QUESTION 3

After the following code executes, the values in the array are ___, ____, ____ (numeric values).

QUESTION 4

Given this following code:

int[][] a = new int[2][3];

Indicate all statements that are true.

A) a[0].length has a value of 2.

B) a.length has a value of 2.

C) Variable a has a primitive data type.

D) a[2][3] is a cell of array a with a value of 0.

E) Array a is a two dimensional array.

F) a[0][1] is a cell of array a with a value of 0.

QUESTION 5

Indicate all true statements about arrays in Java.

A) It is impossible to create a 5 dimensional array in Java because maximum dimension is limited to 3.

B)Array index starts from 1.

C) An array variable is of a reference type even if its elements have a primitive type.

D) When an array is created, all cells are initialized with default value according to element type.

Explanation / Answer

Question1

1. 10
2. 10
3. 10 int
4. 0 0
5. 9

Question 2

60

Question3

0,1,2


Question 4

A) False
B) True
C) False
D) False (indexes can not go to 2 and 3)
E) True
F) True

Question 5

A) False (Java does not restrict that but JVM puts it as 255)
B) False
C) True
D) True

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote