举一反三
- 执行下面程序段后,输出的结果为( )。 Dim m(5) As Integer s = 0 For i = 0 To 5 m(i) = 5 Next i For j = 0 To 5 s = s + m(j) Next j Print s
- 有如下程序: Const N=-5 Const M=6 Dim a(N To M)As Integer For i=LBound(a)To UBound(a) a(i)= i Next i Print a(LBound(a));a(UBound(a)) 运行后,输出结果为( )。
- 下列程序段的运行结果为( )。Dim m(10)For i = 0 To 9 m(i) = 2 * iNext iPrint m(m(3)) A: 12 B: 6 C: 0 D: 4
- 下列程序段的运行结果为( )。 Dim m(10) For i = 0 To 9 m(i) = 2 * i Next i Print m(m(3)) A: 12 B: 6 C: 0 D: 4
- 程序段如下,程序运行后消息框显示的结果是______。 Dim a, s As String, i As Integer a = "晴空万里" s = "" For i = 1 To 4 Step 2 s &= Mid(a, 4 - i, 2) Next MsgBox(s)? 万里|晴空|万里晴空|晴空万里
内容
- 0
运行下列程序,单击窗体显示的结果为( )。 Private Sub Form_Click() Dim a Dim s As Integer, i As Integer a = Array(1, 2, 3) For i = 2 To 0 Step -1 s = s + a(i) * a(i) Next i Print s End Sub
- 1
在下列程序段中,不能计算1到100之间奇数之和的是__________。 A: Dim sum As Integer sum = 0 For i = 1 To 100 Step 2 sum = sum + i Next B: Dim sum As Integer sum = 0 For i = 1 To 100 If i Mod 2 <> 0 Then sum = sum + i Next C: Dim sum As Integer sum = 0 For i = 1 To 99 sum = sum + i Next D: Dim sum As Integer sum = 0 For i = 100 To 1 Step -1 If i Mod 2 <> 0 Then sum = sum + i Next
- 2
下列程序段的执行结果为 _______。 Dim a(3, 5) As Integer Dim i As Integer, j As Integer For i = 1 To 3 For j = 1 To 5 a(i, j) = a(i - 1, j - 1) + (i - 1) * 5 + j Next j Next i Print a(3, 4)
- 3
下列程序的运行结果为( )。 Private Sub Command1_Click() Dim a(5) As String Dim i As Integer For i = 0 To 5 a(i) = i + 1 Print a(i); Next i End Sub
- 4
执行下列程序后,输出的结果是 Option Base 0 Dim a a = Array(13,8,4,15) m = a(0) : n = a(0) For i=1 to 3 If a(i) > m Then m = a(i) ElseIf a(i) < n Then n = a(i) End If Next i Print m; n A: 2 4 B: 4 10 C: 4 15 D: 10 15 E: 其它选项都不对