要将字符串数组a中所有学生姓名按数组下标顺序追加到列表框List1中,可以使用的程序段为( )。
A: List1.AddItem a
B: For i = 0 To UBound(a) - 1 List1.AddItem a(i), 0 Next i
C: For i = 0 To UBound(a) – 1List1.List(i)=a(i)Next i
D: For i = 0 To UBound(a) - 1 List1.AddItem a(i) Next i
A: List1.AddItem a
B: For i = 0 To UBound(a) - 1 List1.AddItem a(i), 0 Next i
C: For i = 0 To UBound(a) – 1List1.List(i)=a(i)Next i
D: For i = 0 To UBound(a) - 1 List1.AddItem a(i) Next i
举一反三
- 使用数组x输出10个1-100之间的随机整数(包括1和100),下列命令中正确的是:( ) A: Dim x(9) As Integer For i = 1 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next B: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Rnd(10) Print x(i); Next C: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 ) Print x(i); Next D: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next
- 执行了下面的程序: Sub Form_Click() For i=1 To 6 List1.AddItem i Next For i=1 To 3 List1.RemoveItem i Next End Sub 列表框中的数据项为( )。
- 初始了如下二维数组,( )能够遍历该二维数组。 int [ ][ ] arr={{3,4,5},{7,8,2},{1},{6,2,8}}; A: for(int i=0;i B: for(int i=0;i C: for(int i=0;i D: for(int list:arr) for(int x:list) System.out.println(x); E: for(int[ ] list:arr) for(int x:list) System.out.println(x);
- 执行以下程序,MsgBox输出的值是________。Dim i, a(9) As Integera(0) = 1a(1) = 1For i = 2 To UBound(a)a(i) = a(i - 1) + a(i - 2)Next iMsgBox(a(9))
- (4-3)初始了如下二维数组,( )能够遍历该二维数组。 int [ ][ ] arr={{3,4,5},{7,8,2},{1},{6,2,8}}; A: for(int i=0;i for(int j=0;j System.out.println(arr[i][j]); B: for(int i=0;i for(int j=0;j System.out.println(arr[i][j]); C: for(int i=0;i for(int x:arr[i]) System.out.println(x); D: for(int list:arr) for(int x:list) System.out.println(x); E: for(int[ ] list:arr) for(int x:list) System.out.println(x);