An array subscript may be an integer or an integer expression. If a program uses an expression as a subscript, then the expression is evaluated to determine the particular element of the array.
T
1-2
分数 1
作者 翁恺
单位 浙江大学
There is a length()
method for all the arrays to represent the number of elements
F
1-3
分数 1
作者 翁恺
单位 浙江大学
Arrays in Java can change its size as needed.
F
分数 2
作者 翁恺
单位 浙江大学
- Given
a=new int[10]
, which expression below can causeArrayIndexOutOfBoundsException
?
A.
a[0] += 9;
B.
a[9]=10;
C.
a[9]
D.
for(int i=0;i<=10;i++) a[i]++;
2-2
分数 2
作者 翁恺
单位 浙江大学
Given the following expression: int m[] = {0, 1, 2, 3, 4, 5, 6 };
Which result of the following expressions equals to the number of the array elements? ( )
A.
m.length()
B.
m.length
C.
m.length()+1
D.
m.length+1
2-3
分数 2
作者 徐硕博
单位 浙江大学
What does the following line of code do?
quantity = new int[3];
A.
Creates storage for three doubles.
B.
Creates storage for three int.
C.
Creates storage for unlimited doubles.
D.
Creates storage for unlimited int