1.选择题- (共4题)
1.
有如下 VB 程序段:
Private Sub Commandl_Click()
Dim s As String, res As String, ch As String
Dim i As Integer
s=Textl.Text:res="":ch=""
For i=1 To Len(s)
ch=Mid(s,i,l)
If Not(ch>="0"And ch<="9"=Then
res=ch+res
End If
Next i
Labell.Caption=res
End Sub
在文本框 Textl 中输入“Qns 2020_GK”后单击按钮 Command1,在标签Labell 中显示( )
Private Sub Commandl_Click()
Dim s As String, res As String, ch As String
Dim i As Integer
s=Textl.Text:res="":ch=""
For i=1 To Len(s)
ch=Mid(s,i,l)
If Not(ch>="0"And ch<="9"=Then
res=ch+res
End If
Next i
Labell.Caption=res
End Sub
在文本框 Textl 中输入“Qns 2020_GK”后单击按钮 Command1,在标签Labell 中显示( )
A.Qns_GK | B.QnsGK | C.KG_snQ | D.KGsnQ . |
2.
某查找算法的VB 程序如下:
Private Sub Commandl_Click()
mid 2=j-(j-i)\3
If key=a(midl) Then
flag=True
ElseIf key<a(midl) Then
j=midl-l
ElseIf key=a(mid 2) Then
flag=True
ElseIf key>a(mid2) Then
i=mid2+1
Else
i=mid1+1
j=mid2-1
End If
该程序段执行时,在文本框Text1中输入36,单击命令按钮Command1,程序运行结束后,i和j的值为( )
Private Sub Commandl_Click()
Dim a(1 To 9) As Integer, key As Integer, i As Integer,j As Integer
Dim mid 1 As Integer,mid 2 As Integer
a(1)=4:a(2)=22:a(3)=27:a(4)=32:a(5)=35:a(6)=44:a(7)=56:a(8)=59:a(9)=78
key=Val(Textl.Text)
i=1:j=9
flag=False
Do While i<=j And Not flag
midl=i+(j-i)\3mid 2=j-(j-i)\3
If key=a(midl) Then
flag=True
ElseIf key<a(midl) Then
j=midl-l
ElseIf key=a(mid 2) Then
flag=True
ElseIf key>a(mid2) Then
i=mid2+1
Else
i=mid1+1
j=mid2-1
End If
Loop
If flag Then Labell.Caption=″查找成功!″Else Labell.Caption=″查找失败!″
End Sub该程序段执行时,在文本框Text1中输入36,单击命令按钮Command1,程序运行结束后,i和j的值为( )
A.4,5 | B.6,5 | C.5,6 | D.6,4 |
3.
有如下VB 程序段:
Private Sub Commandl_Click()
Dim d(l To 6) As Integer
Dim t As Integer
d(1)=35:d(2)=18:d(3)=63:d(4)=5:d(5)=85:d(6)=47
For i=1 To 3
t=d(j):d(j)=d(j-1):d(j-1)=t
End If
Next i
End Sub .
执行该程序段后,文本框 Textl输出的内容是( )
Private Sub Commandl_Click()
Dim d(l To 6) As Integer
Dim t As Integer
d(1)=35:d(2)=18:d(3)=63:d(4)=5:d(5)=85:d(6)=47
For i=1 To 3
For j=i+1 To 6
If d(j)<d(j-1) Thent=d(j):d(j)=d(j-1):d(j-1)=t
End If
Next j
Textl.Text=Str(d(i))+Text1.TextNext i
End Sub .
执行该程序段后,文本框 Textl输出的内容是( )
A.47 63 85 | B.35 5 18 | C.85 63 47 | D.18 5 35 |
试卷分析
-
【1】题量占比
选择题:(4道)
-
【2】:难度分析
1星难题:0
2星难题:0
3星难题:0
4星难题:0
5星难题:0
6星难题:0
7星难题:0
8星难题:0
9星难题:4