下列给整型二维数组进行赋值的语句中,错误的是( )
A: int
arr[][] = {{0}, {1,2}, {3, 4}};
B: int
arr[][] = {{0}, {1,2, 3, 4}};
C: int
arr[2][2] = {{1,2}, {3, 4}};
D: int
arr[][] = {{1,2}, {3, 4}};
A: int
arr[][] = {{0}, {1,2}, {3, 4}};
B: int
arr[][] = {{0}, {1,2, 3, 4}};
C: int
arr[2][2] = {{1,2}, {3, 4}};
D: int
arr[][] = {{1,2}, {3, 4}};
举一反三
- 下列给整型二维数组进行赋值的语句中,错误的是()。 A: int i[][] = {{0}, {1,2}, {3, 4}}; B: int i[][] = {{0}, {1,2, 3, 4}}; C: int i[2][2] = {{1,2}, {3, 4}}; D: int i[][] = {{1,2}, {3, 4}};
- 下面正确创建了二维交错数组的是()。 A: int[][] Arr=new int[3][];Arr[0]=new int[]{10,20,30};Arr[1]=new int[]{40,50,60,70};Arr[2]=new int[]{80,90}; B: int[,] Arr=new int[3,];Arr[0]=new int[]{10,20,30};Arr[1]=new int[]{40,50,60,70};Arr[2]=new int[]{80,90}; C: int[][3] Arr={new int[]{10,20,30},new int[]{40,50,60,70},new int[]{80,90}}; D: int[3][] Arr={new int[3]{10,20,30},new int[4]{40,50,60,70},new int[2]{80,90}};
- 【单选题】执行完以下代码后,数组 arr 的各个元素的取值是什么? int[] arr = {1, 2, 3}; for (int i=0; i < 2; i++) arr[i] = 0; A. arr[0]=0, arr[1]=0, arr[2]=0 B. arr[0]=1, arr[1]=2, arr[2]=3 C. arr[0]=0, arr[1]=0, arr[2]=3 D. arr[0]=0, arr[1]=2, arr[2]=3
- 下列选项中关于二维数组的定义,格式错误的是( ) A: int [][]arr = new int[3][4] B: int [][]arr = new int[3][] C: int[][] arr = new int[][4] D: int [][]arr = {{1,2},{3,4,5},{6}}
- 以下不能对二维数组a进行正确初始化的语句是( ). A: int<br/>a[2][3] = {0}; B: int<br/>a[ ][3] ={{1,2},{0}}; C: int<br/>a[2][3] = {{1,2}, {3,4}, {5,6}}; D: int<br/>a[ ][3] = {1, 2, 3, 4, 5, 6};