下面代码输出结果是()int[]num={1,1,2,3,4};inta=1;for(inti=0;i{a=a+num[i];}Console.WriteLine(a);[/i]
A: 4
B: 10
C: 11
D: 12
A: 4
B: 10
C: 11
D: 12
举一反三
- 在C#中,下列代码的运行结果是int[] num = new int[5] { 1,2,3,4,5 };Array.Reverse(num); foreach (int i in num) { Console.Write(i); } A: 54321 B: 54321 C: 1 2 3 4 5 D: 12345
- 在C#中,下列代码的运行结果是() int[] num = new int[]{1,3,5}; ArrayList arr = new ArrayList(); for(int i=0;i A: 1 B: 3 C: 4 D: 5
- 下面代码运行结果是()。publicclassTest{publicstaticvoidmain(String[]args){int[]a=newint[3];int[]b=newint[]{1,2,3,4,5};a=b;for(inti=0;i<=b.length;i++){System.out.print(a[i]+ " "); }}}[/i] A: 1 2 3 4 B: 1 2 3 C: 0 1 2 3 4 D: 数组越界异常
- 下列代码段执行后的结果是()int[] a = { 1, 3, 5, 2, 4 };int j = 4;for (int i = 0; i <; 5; i++) { a[i] = a[j]; j--;}for (int i = 0; i <; 5; i++) System.out.print(a[i] + " ");[/i][/i] A: 1 2 3 4 5 B: 5 4 3 2 1 C: 4 2 5 2 4 D: 4 2 5 3 1
- 以下程序的输出结果是【 】。 class Program { public static void Main(string[] args) { int[] a = new int[3] { 1, 2, 3 }; for (int i = 0; i < 3; i++) Console.Write("{0} ", a[i]); Console.WriteLine(); int[] b = a; for (int i = 0; i < 3; i++) b[i] = 2 * b[i]; for (int i = 0; i < 3; i++) Console.Write("{0} ", a[i]); Console.WriteLine(); Console.Read(); } }[/i][/i][/i][/i]