浙江省金华市江南中学2020届高三信息技术网课2月22日第二周测试卷
试卷更新日期:2020-05-22 类型:月考试卷
一、选择题(25*2=50分)
-
1. 下列表达式的运算结果与其他选项不同的是( )A、Len("123") + 2 ^ 2 B、Abs(Int(-6.8)) C、Asc(Mid("789", 1, 1)) D、Val("9") - Sqr(4)2. 下列VB表达式中,随机产生10到100之间奇数的是( )A、Int(Rnd*45) *2+ 10 B、Int(Rnd*45) *2+11 C、Int(Rnd*90+10) D、Int(Rnd*90+11)3. 有如下VB程序段:
For i = 1 To 9 Step 2
b(a(i) Mod 10) = b(a(i) Mod 10) + 1
Next i
s = 0
For i = 0 To 9 Step 3
s =s + b(i)
Next i
数组b各元素初始值为0, 数组元素a(1)到a(9)的值依次为“29,74,12,38,16,45,21,57,33”,则执行该程序段后,s的值为( )
A、5 B、4 C、3 D、24. 有如下VB程序段:a(1) = 1
For i = 2 To 6
Randomize
a(i) = a(i - 1) + Int(Rnd * 5 + 1)
If a(i) Mod 2 = 1 Then
a(i) = a(i) \ 2 + 1
Else
a(i) = a(i) / 2
End If
Next i
执行程序后,a数组各元素可能是( )
A、1 3 4 6 7 9 B、1 2 0 3 5 6 C、1 2 3 4 5 4 D、1 3 4 5 1 15. 有如下VB程序段:s = "123456789"
g = ""
For i = 1 To 3
n = Len(s)
x = Int(Rnd * n) + 1
g = g + Mid(s, x, 1)
s = Mid(s, 1, x - 1) + Mid(s, x + 1, n - x)
Next i
在程序执行时,若变量x的值依次为3,3,6,则最终变量g的值为( )
A、"336" B、"346" C、"348" D、156. 有如下VB程序段:For i= 1 To 3
For j= 1 To 5-i
If a(j) >a(j+1) Then
t=a(j):a(j)=a(j+1):a(j+1)=t
End If
Next j
Text 1.Text=Text 1.Text+str(a(i) )
Next i
数组元素a(1)到a(5)的值依次为“3,9,6,8,4”。该程序段执行后,文本框Text 1显示的内容是( )
A、346 B、689 C、364 D、3667. 某对分查找算法的VB程序段如下:i = 1: j = 8: s = ""
key =Text1.Text
Do While i <= j
m =(i + j) \ 2
If key = a(m) Then
s = s + "M"
Exit Do
ElseIf key > a(m) Then
j = m - 1: s = s + "L"
Else
i = m + 1: s = s + "R"
End If
Loop
Text1.Text = s
数组元素a(1)到a(8)的值依次为“4,22,27,32,35,44,56,59”,该程序段执行后,文本框Text1中显示的内容不可能是( )
A、M B、LR C、RM D、LM8. 某VB程序段如下:s = "Hello World"
s1 = ""
n = Len(s)
For i = 1 To n \ 2
If Mid(s, i, 1) > Mid(s, n - i + 1, 1) Then
s1 = s1 + Mid(s, i, 1)
Else
s1 = Mid(s, n - i + 1, 1) + s1
End If
Next i
Text1.Text = s1
执行该程序段后,在文本框Text1中显示的是( )
A、WlleH B、oorld C、dlroo D、orldo9. 有如下VB程序段:For i= 1 To 8
a(i) =Int(Rnd*2)
Next i
sum= 0
For i=1 To 8 Step 3
For j=i To 8
a(j)=1-a(j)
Next j
sum=sum+a(i)
Next i
Text 1.Text=Str(sum)
执行该程序段后,文本框Text 1中显示的内容不可能是( )
A、0 B、2 C、3 D、410. 有VB程序段如下:s = "2019appreciate": sum = 0
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "a" And ch <= "z" Then
m = Asc(ch) - Asc("a") + 1
a(m) = a(m) + 1
End If
Next i
For i = 1 To 10
If a(i) > 0 Then sum = sum + 1
Next i
数组a各元素的初始值都为0,执行该程序段后,变量sum的值为( )
A、10 B、7 C、4 D、311. 有VB序段如下:Randomize
For i= 1 To 6
a(i) =Int(Rnd*20) + 1
If a(i) Mod 2=i Mod 2 Then
a(i)=a(i)-1
Else
a(i)=a(i)+2
End If
Next i
执行该程序段后,a(1)~a(6)各元素可能的是( )
A、13,2,7,12,5,18 B、22,7,0,15,4,19 C、20,9,18,23,4,7 D、6,0,4,21,18,1712. 某排序算法的VB程序段如下:For i = 1 To 2
For j = 1 To 6 - 2 * i
If a(j) < a(j + 2) Then
t = a(j): a(j) = a(j + 2): a(j + 2) = t
End If
Next j Next i
数组元素a(1)~a(6)的初始值依次为“15,13,44,38,26,7”,执行该程序段后,数组a元素的值分别为( )
A、44,38,26,13,15,7 B、44,7,26,13,15,38 C、15,38,26,13,44,7 D、44,38,26,15,13,713. 有VB程序段如下:Dima( 1 To 5) As Integer
Dimi As Integer, j As Integer, s As String
s=“”
For i= 2 To 5
For j=i To 5
If j Mod i=0 Then a(j) =a(j)+1
Next j
Next i
For i= 1 To 5
If a(i) <>1Then s=Str(i) +s
Next i
Text 1.Text=S
若数组a的初始值都为0,则运行该程序段后,Text 1中显示的内容为( )
A、14 B、235 C、532 D、4114. 有如下VB程序段: For i= 1 To 5a(i)= Int(Rnd * 20) + 1 Next i
For i= 2 To 5
If i Mod 2 = 1 And a(i-1) < a(i)Then t=a(i):a(i)=a(i-1):a(i-1)=t
Else
a(i)=a(i)-1 End If
Next i
执行该程序段后,a(1)~ a(5)各元素不可能的值是( )
A、7 3 0 19 0 B、18 16 1 9 2 C、20 17 8 19 15 D、19 0 7 8 415. 有如下VB程序段:For i= 1 To 10
b(i)=0
Next i
For i= 1 To 5
For j= 1 To 10
If b(i) <a(j) Then
b(i)=a(j)
t=j
End If
Next j
a(t)=0
List 1.Additem Str(b(i) )
Next i
其中数组元素a(1)到a(10)的值依次为“25,42,53,66,77,83,98,14,38,99”,执行程序后,在列表框List 1中依次输出的数据是( )
A、25 42 53 66 77 B、14 25 38 42 53 C、99 98 83 77 66 D、83 98 14 38 9916. 下列程序段执行后,文本框Text 1中显示的内容是( )s=“QUOTES:keep on going never give up!”
flag=False:m=0
For i=1 To Len(s)
ch=Mid(s,i,1)
If ch>=“a” And ch<=“z” Then
If Not flag Then
m=m+1
flag=True
End If
Else
flag=False
End If
Next i
Text 1.Text=Str(m)
A、5 B、6 C、7 D、2117. 下面程序的功能是:产生20个[1,100]范围内的随机整数,并统计这20个随机数中的整数的个数(重复出现算1个),结果显示在标签Label 1中。例如:5个随机数[10,20,20,31,32]中不重复数字个数为3。程序部分代码如下:count=0
For i=1 To 20
a(i) =Int(Rnd*100) + 1
Next i
For i= 1 To 20
①
Next i
For i= 1 To 100
If b(i) <> 0 Then count =count+1
Next i
Label 1.caption=“不重复数字个数”+Str(count)
为实现上述功能,则程序①处应填入的语句为( )
A、b(i)=1 B、b(a(i))=a(b(i))+1 C、b(i)=b(i)+1 D、b(a(i))=b(a(i))+118. 有如下VB程序段:Dim i As Integer, sum As Integer
Dim a(1 To 6) As Integer, b(1 To 6) As Integer
sum = 0
a(6) = 18: a(5) = 7: b(6) = 14: b(5) = 16
For i = 4 To 1 Step -1
a(i) = a(i + 2) - a(i + 1)
b(i) = b(i + 2) - a(i)
If b(i) Mod 3 = 0 Then sum = sum + b(i)
Next i
Text1.Text = Str(sum)
该程序段运行后,文本框Text1中显示的内容是( )
A、39 B、30 C、-9 D、1219. 某VB程序段如下:Dim a (1 To 6) As Integer
Randomize
a(1) = Int (Rnd*2) + 1
For i = 2 To 6
a(j) = Int (Rnd*i) *2 + 1
If a(i) < a(i-1) Then
a(i) = a(i) + a(i-1)
End If
Next i
执行该程序段后,数组元素a(1)到a(6)的值可能是( )
A、2,4,6,8,10,12 B、1,1,3,7,12,23 C、2,5,9,11,10,15 D、1,3,15,16,20,2320. 如果数组a(下标1到n)满足a(1)≤a(2)≤…≤a(i-1)≤a(i)≥a(i+1)≥…≥a(n),则称数组a是单峰的,并称a(i)是数组a的“峰顶”。下列程序段用于查找数组a中的“峰顶”,并返回该“峰顶”值。Dim a( 1 To 10) As Integer
Function Search(L As Integer, R As Integer)
As Integer
M=(L+R)\2
If a(M) <a(M-1) And a(M) >a(M+1) Then
①
ElseIf a(M) >a(M-1) And a(M) >a(M+1) Then
②
ElseIf a(M) >a(M-1) And a(M) <a(M+1) Then
③
End If
End Function
Private Sub Command 1 click()
Label 1.caption=““峰顶”值是:” +Str(Search (1,10))
End Sub
上述程序中划线处可选语句为:
①Search=Search(M+1,R)
②Search=Search(L,M-1)
③Search=a(M)
则①②③处的语句依次是( )
A、①②③ B、①③② C、③①② D、②③①21. 有如下VB程序段,已知a数组各元素值为“7,5,6,3,1,8”,b数组各元素的初始值为“0”。则经过以下程序段处理后,b数组各元素分别为( )For i = 1 To 5
k = i
For j = i + 1 To 6
If a(k) > a(j) Then k = j
Next j
t = a(k): a(k) = a(i): a(i) = t
b((i + 2) Mod 6 + 1) = a(i)
Next i
A、1 3 5 6 7 8 B、7 0 1 3 5 6 C、6 7 8 1 3 5 D、6 7 0 1 3 522. 数组a中有n个正整数,对该数组进行排序,生成左右交替上升数据序列。实现该功能的VB程序段如下:For i=1To n\2
k=i
If a(j) <a(k) Then k=j
Next j
If i<>k Then
t=a(i):a(i)=a(k):a(k)=t
End If
If Then
t=a(j):a(j)=a(j+1):a(j+1)=t
End If
Next j
Next i
上述程序中方框处可选语句或表达式有:
①For j=i+1 To n-i+ 1 ②For j=i+1 To n-i
③a(j)<a(j+1) ④a(j)>a(j+1)
则(1)、(2)、(3)处语句依次是( )
A、①、②、③ B、①、②、④ C、②、①、③ D、②、①、④23. 某二分查找算法的VB程序段如下:key=Va 1(Text 1.Text)
i=1
j=9
Text 2.Text=""
Do While i<=j
If key=a(m) Then Exit Do
If key<a(m) Then i=m+1 Else j=m-1
Text 2.Text=Text 2.Text+“”+Str(a(m) )
Loop
数组元素a(1)到a(9)的值依次为88,75,70,68,61,58,55,50,43,文本框Text 1中输入的值是58,执行该程序段,文本框Text 2中显示的是61,50,55,则方框处的代码应为( )
A、m=(i+j+1)\2 B、m=(i+j)\2+1 C、m=(i+j)\2 D、m=(i+j-1)\224. 有如下VB程序段:y=0
n=Len(Text 1.Text)
For i=1To n
c=Mid(Text 1.Text,i,1)
If c>=“0”And c<=“9”Then
x=Val(c) :a(x) =a(x) + 1
End If
Next i
For i= 0 To 9
If a(i) >0Then y=y+ 1
Next i
Label 1.Caption=Str(y)
a数组各元素的初值为0,程序运行时,在文本框Text 1中输入内容“pi=3.1415926535”,单击按钮Command 1后,标签Label 1中显示的内容是( )
A、6 B、7 C、8 D、925. 有如下VB程序段:s=Text 1.Text:n=0:f=False
For i=1 To Len(s)
ch=Mid(s,i,1)
If ch>="0" And ch<="9" Then
If Not f Then
f=True:n=n+1
End If
Else
f=False
End If
Next i
运行该程序段后,在文本框Text 1中输入“13+(123-23) *2”则变量n的值为( )
A、1 B、4 C、8 D、13