数组复习题
1. 数组元素的下标总是从_____开始。
2. 对于数组 int t[][]={{1,2,3},{4,5,6}}来说,t.length 等于______,t[0].length 等
于______。
3. 已知数组 a 的定义为“int a[]={1,2,3,4,5};”,则 a[2]=____,数组 b 的定义为“int
b[]=new int[5];” , 则 b[2]=______ , 数 组 c 的 定 义 为 “Object [] c=new
Object[5];”,则 c[2]=_____。
4. 调用数组元素时,用____和_____来唯一确定数组中的元素。
5. 下列_____语句有错误
A. int [] a; B.int [] b=new int[10]; C. int []c=new int[]; D.int d[]=null;
6. 下列_____语句有错误
B. A.int a[][]=new int[5][5]; B.int [][] b=new int[5][5];
C. C.int []c[]=new int[5][5]; D.int [][]d=new int[5,5];
7. 关于下面的程序,正确的结论是_____
public class Demo1{
public static void main(String [] args){
int a[]=new int[5]; boolean b[]=new boolean[5];
System.out.println(a[1]); System.out.println(b[2]);} }
A.运行结果为 0 false B.运行结果为 1 true
C.程序无法编译 D.可以通过编译但结果不确定