试题 试卷
题型:单选题 题类:常考题 难易度:普通
浙教版高一信息技术 专题五:VB程序设计
Max=-10000
For i=1 To 10
s=0
For j=i To 10
s=s+a(j)
If s>max Then max=s
Next j
Next i
已知数组a(1)到a(10)的原始数据为6,-6,8,-7,7,2,-2,-1,-2,4。程序执行后,变量max的值为( )
Private Sub Command1_Click()
Dim s As Integer, j As Integer
s = 0
For j = 1 To 10
If j Mod 2 <> 0 Then
s = s + j
End If
Label1.Caption = Str(s)
End Sub
Dim a As Integer, b As Integer
a = Val(Text1.Text)
If a Mod 2 = 0 Then
b = a + 1
ElseIf a Mod 3 = 0 Then
b = a + 2
ElseIf a Mod 5 = 0 Then
b = a + 4
Else
b = a
Label1.Caption = Str(b)
运行该程序,在文本框Text1中输入25,单击命令按钮Command1,在标签Label1中显示的是( )
flag = True : i = 1
Do While i <= 6
x = Int(Rnd * 100) + 1
If flag Or x >50 Then
a(i)=x
flag = Not flag
i = i + 1
End if
Loop
执行该程序段后,在下列选项中,a(1)~a(6)各元素值不可能的是( )
输入x的值为7,执行这部分流程,输出n的值为( )
试题篮