试题 试卷
题型:单选题 题类:常考题 难易度:普通
浙江省之江教育评价联盟2019-2020学年高三上学期信息技术第二次联考试卷
s = "2019Nian12yue3Ri"
For i = Len(s)-1 To 1 step -1
If Mid(s, i, 1) <= "9" And Mid(s, i + 1, 1) >= "A" Then
sum= sum+ Val(Mid(s, i, 1))
End If
Next i
运行程序后,变量sum 的值是( )
Private Sub Command1_click ( )
Dim n As Integer , m As Integer , k As Integer
n = Len ( Text1.Text )
m = Val ( Text2.Text )
k = Val ( Text3.Text )
If m + k -1 > n Then
Text4.Text = Mid ( Text1.Text , 1 , m – 1 )
Else
Text4.Text = Mid ( Text1.Text , 1 , m–1 ) + Mid ( Text1.Text , m+k , n–m–k +1 )
End Sub
程序界面如图所示,当单击“求解”按钮Command1时,在列表框List1中显示所有满足条件的组合。
程序代码如下,请在划线处填上合适的代码。
Dim a(0 To 9) As Integer
Private Sub Command1_Click()
Dim i, n, m As Integer
For i = 123 To 333
For n = 1 To 9
a(n) = 0
Next n
s = 0
call fenjie (i) ‘使用call调用自定义过程,下同
call fenjie (2 *i)
call fenjie (3 *i)
For m = 1 To 9
s ={#blank#}1{#/blank#}
Next m
If s = 9 Then List1.AddItem i & “ ” & 2 * i & “ ” & 3 * i
Sub fenjie(x As Integer) ‘自定义过程,将3位数分解并修改对应下标元素的值
a(x Mod 10) = 1
{#blank#}2{#/blank#}
a(x \ 100) = 1
For i=1 To 8
d(i)= In(Rnd*10)
For i= 2 To 8
If i Mod 2=0 And d(i)> d(i-1)Then
d(i)=d(i-1)+1
ElseIf i Mod 2= 1 Then
If d(i)>d(i-2) Then
t=d(i): d(i)=d(i-2): d(i-2)=t
Next i( )
试题篮