试题 试卷
题型:单选题 题类:常考题 难易度:普通
浙江省高中信息技术 VB基本语句同步练习
Private Sub Command1_Click()
Dim sum As Double, x As Double
sum = 0
n = 0
For i = 1 To 5
x = n / i
n = n + 1
sum = sum + x
Next
End Sub
该程序通过For循环计算sum的值,下列表达式的值与sum相等的是( )
PRIVATE SUB FORMCLICK
FOR I = 3 TO {#blank#}1{#/blank#}
F=0
FOR J= 2 TO I-1
IF {#blank#}2{#/blank#} THEN
F=1
EXIT FOR
END IF
NEXT J
IF F=0 THEN {#blank#}3{#/blank#}
{#blank#}4{#/blank#}
END SUB
Dim a(1 To 5) As Integer Randomize
s = 0
Do While s<5
t = Int(Rnd * 5 + 1) a(t) = a(t) + 1
If a(t) = 1 Then s = s + a(t)
Loop
已知数组a(1)到 a(5)的初值均为0,该段程序运行后,下列说法正确的是( )
试题篮