题目内容

有如下定义:int[] x=new int[]{0,2,4,4,5,6,7,8,9,10};则数组x在内存中所占的字节数是

A. 10
B. 20
C. 40
D. 80

查看答案
更多问题

下列程序的输出结果是public static void main(string[] args){int[] x = { 22, 33, 44, 55, 77, 88,99 };int k, y = 0;for (k = 1; k <= 4; k++)if (x[k] % 2 == 1)y++;System.out.println(y);}

A. 0
B. 1
C. 2
D. 3

下列程序的输出结果是( )public static void main(String[] args){int k=5;int[] a = new int[10];int[] p=new int[3];for (int i = 0; i < 10; i++)a[i] = i;for (int i = 0; i < 3; i++)p[i] = a[i * (i + 1)];for (int i = 0; i < 3; i++)k += p[i] * 2;System.out.println(k);}

A. 20
B. 21
C. 22
D. 23

下列程序的输出结果是public static void main(String[] args){final int MAX= 10;int[] a= { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };int sum = 1;for (int i = 0; i < MAX; i++)sum = sum - a[i];System.out.println(sum);}

A. 54
B. 55
C. -54
D. -55

下列程序的输出结果是( )public static void main(String[] args){int y = 18, i = 0;int[] a = new int[8];do{a[i] = y % 2;i++;y = y / 2;} while (y >= 1);for (int j = i - 1; j > 0; j--)System.out.println (a[j]);}

A. 1000
B. 1001
C. 1010
D. 1100

答案查题题库