浙江省2019年信息技术选考模拟试卷四
年级: 学科:信息技术(信息科技) 类型: 来源:91题库
一、选择题 (共12小题)
下列说法正确的是( )
在该数据表中录入数据时,下列操作能实现的是( )
执行该算法,依次输入a的值为3,5,2后,算法的输出结果为( )
①使用剪裁工具将声音文件的时间变为原来的一半
②使用“效果”-“音量”-“更改音量”将音量调整为50%
③将文件保存为sound2.wav
下列描述与图中信息不相符的是( )
min=a(1)
n=Val(Text1.Text)
For i=n to 2 step -1
If a(i)<min Then
min=a(i)
Next i
Text2.Text=Str(min)
假设在文本框Text1中输入“8”,则文本框Text2输出的值是( )
'顺序查找代码,查找次数用变量p表示
For i = 1 To 10
If a(i) = Key Then
p = i
End If
Next i
'二分查找代码,查找次数用变量q表示
i=1 :j=10 :find=Fasle
Do While i<=j And find=fasle
x =(i+j)\2
q = q+1
If a(x)=Key Then find=True
If a(x)>Key Then j=x-1
If a(x)<Key Then i=x+1
Loop
若变量key的值为13,程序运行后,则变量p和q的值分别是( )
二、非选择题 (共5小题)
图1
图2
图3
图1
图2 图3
Private Sub Command1_Click()
Dim n As Integer,k As Integer,s As Long
If n>=10 Or n<=0 Then
Label2.Caption=“请输入一个小于10的正整数”
Else
s=0
For k=1 To n
s=s+k*k
Label2.Caption=Str(s)
End If
End Sub
图1
图2
图3
图4
查找的英文单词由连续的ASCII英文字符(a~z或A~Z)组成。组合词程序会进行分解,如river-small可拆分为2个单词river和small,查找的英文单词不区分大小写。程序代码如下,但加框处代码有错,请改正:
Private Sub Command1_Click()
Dim article As String,f As String,count As Integer
Dim i As Intege,,begin As Integer,s As String
article=Text1.Text : f=Text2.Text : count=0
begin = 1
For i=1 To Len(article)
t = Mid(article,i,1)
If Not(t>="A"And t<="Z" Or t>="a" And t<="z") Then
If i > begin Then
s = '①
If LowerCase(f)=LowerCase(s) Then
count = count+1
End If
End If
begin = i + 1
End If
Next i
Text3.Text=Str(count)
End Sub
Function LowerCase(word As String) As String '单词转化为全小写的形式
Dim i As Integer,c As String
For i=1 To Len(word)
c = Mid(word,i,1)
'小写英文字母的ASCII码值比大写字母的值大32
If c>="A" And c<="Z" Then c = '②
LowerCase = LowerCase + c
Next i
End Function
以上程序段运行时,为了实现上述功能,加框处代码应改正为:
① ;② 。
Dim a(1 To 25) As Integer '数组a用于存储1~100之内的素数
Function search(k As Integer) As Integer
i = 1 : j = 25
Do While i <= j
m =
If a(m) = k Then
search = m : Exit Function
ElseIf k < a(m) Then
j = m - 1
Else
i = m + 1
End If
Loop
search = 0
End Function
Private Sub Command1 Click() '生成素数事件过程
Dim i, j, k As Integer
List1.Clear
k = 0
For i = 2 To 100
For j = 2 To i - 1
If i Mod j = 0 Then
Exit For
End If
Next j
If Then
k = k + 1
a(k) = i
List1.AddItem "a(" & k & ")=" & a(k)
End If
Next i
End Sub
Private Sub Command2 Click() '查找数据事件过程
Dim t As Integer, r As Integer
t = Val(Text1.Text)
r =
If r = 0 Then
Label3.Caption = "1~100中的素数无此数据!"
Else
Label3.Caption = "素数序列和第" & Str(r) & "个数!"
End If
End Sub