浙江省金华市江南中学2020届高三下学期信息技术4月初测试卷
试卷更新日期:2020-05-19 类型:月考试卷
一、选择题(每道题2分,共26题,52分)
-
1. 有如下VB程序段:
For i= 1 To 49
j=1:a(j)=a(j)+1
Do While a(j)=5
a(j)=0
j = j + 1
a(j) = a(j) + 1
Loop
Next i
数组a中各元素初始值均为0,该程序执行后,数组a中各元素之和为( )
A、9 B、0 C、3 D、492. 有如下VB程序段:s = 1
For i = 2 To 10 Step 3
s = s + i
Next i
则该程序段执行后,变量s和i的值分别是( )
A、16, 11 B、15, 13 C、55, 11 D、25, 133. 有如下VB程序段:c = 0 :i = 1
Do While i <=6
k = i
For j = i + 1 To 7
If a(j)<= a(k) Then k = j
Next j
If a(i) <> a(k) Then
t = a(i): a(i) = a(k): a(k) = t
c = c + 1
End If
i = i + 1
Loop
数组元素a(1)到a(7)的值依次为“9,9,8,16,45,9,78”。该程序段执行后,变量c的值是( )
A、0 B、3 C、4 D、64. 有如下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. 数组d(1)~d(100)中存储某班级50位同学的语文和数学成绩,奇数位存储语文成绩,偶数位存储对应该同学的数学成绩。该数组已经按照两科总成绩升序排序。依据对分查找思想,设计一个在数组a中查找总成绩Key的程序,如果查找成功输出语文成绩在数组中的位置。实现该功能的VB程序段如下:Key = Val(Text1.Text)
i = 1: j = 100
Do While i <= j
m = (i + j) \ 2
If (1) Then m = m - 1
Sum = (2)
If Key = Sum Then Exit Do ‘Exit Do表示退出循环
If (3) Then
i = m + 2
Else
j = m - 2
End If
Loop
If i > j Then Text2.Text = "没有找到!" Else Text2.Text = Str(m)
实现该功能,则上述程序段3个方框处的表达式分别为( )
A、(1)m Mod 2 = 1 (2)d(m) + d(m - 1) (3)Key < Sum B、(1)m Mod 2 = 1 (2)d(m) + d(m + 1) (3)Key > Sum C、(1)m Mod 2 = 0 (2)d(m) + d(m - 1) (3)Key > Sum D、(1)m Mod 2 = 0 (2)d(m) + d(m + 1) (3)Key > Sum6. 有如下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、27. 有如下VB程序段:Dim i As Integer, j As Integer, a(1 To 5) As Integer
For i =1 To 5
a(i)=Int(Rnd*5+1)
For j = 1 To i-1
If a(i)=a(j) Then
i=i-1 : Exit For
End If
Next j
Next i
执行程序后,数组中的数据可能是( )
A、1 4 3 2 5 B、1 1 3 5 4 C、1 4 5 6 3 D、2 3 4 5 58. 有如下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、159. 有如下 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
Text1.Text = Text1.Text + Str(a(i))
Next i
数组元素a(1)到a(5)的值依次为“3,9,6,8,4”。该程序段执行后,文本框 Text1 显示的内容是( )
A、3 4 6 B、6 8 9 C、3 6 4 D、3 6 610. 某VB程序段如下:Function f(n As Integer) As Long
If n = 1 Then
f =5
Else
f =2 * f(n - 1) - 3
End If
End Function
Private Sub Command1_click()
Dim n As Integer
n = Val(Text1.Text)
Text2.Text = Str(f(n))
End Sub
该程序段运行后,在文本框Text1中输入5,单击命令按钮Command1后,文本框Text2中显示的是( )
A、18 B、35 C、63 D、12311. 某对分查找算法的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、LM12. 有如下VB程序段:For i = 1 To 3
k = ""
For j = 1 To 2 * i - 1
k = k + " * "
Next j
List1.AddItem k
Next i
该程序段运行后,在列表框List1中显示的是( )
A、 B、 C、 D、13. 下列程序执行后文本框Text1显示的内容是( )s = "Inter(R) Core(TM) i3-4130 CPU @ 3.40GHz"
flag = False:k = 0
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "A" And ch <= "Z" or ch >= "0" And ch <= "9" Then
If Not flag Then
k = k + 1
flag = True
End If
Else
flag = False
End If
Next i
Text1.Text = Str(k)
A、6 B、9 C、10 D、1814. 有如下VB程序段:Function GCD(m As Long, n As Long) As Long
Dim temp As Long, r As Long
If m < n Then temp = m: m = n: n = temp
d = m - n
Do While d <> n
If d >= n Then
m = d
Else
m = n
n = d
End If
d = m - n
Loop
GCD = n
End Function
Private Sub Command1_Click()
Text1.Text = Str(GCD(48,36))
End Sub
程序运行完后,单击Command1按钮,文本框Text1中显示的是 ( )
A、12 B、18 C、36 D、4815. 有如下VB程序段:Dim a(1 To 5) As Integer, i As Integer
Dim flag As Boolean, j As Integer
a(1) =1 : a(2) = 1 : a(3) = 1 : a(4)= 1 : a(5) = 1
Randomize
For i = 1 To 5
j = 1: flag = True
Do While j <= i - 1 And flag = True
a(i) = Int(Rnd * 5 + 1)
If a(i) = a(j) Then
i = i - 1: flag = False
End If
j = j + 1
Loop
Next i
运行程序后,数组中的数据值可能是( )
A、1 4 3 1 5 B、1 1 3 5 4 C、1 2 3 5 5 D、1 3 4 5 616. 如果数组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 Command1_Click()
Label1.Caption = "“峰顶”值是:" + Str(Search(1, 10))
End Sub
上述程序中划线处可选语句为:
①Search = Search(M + 1 , R)
②Search = Search(L , M - 1)
③Search = a(M)
则(1)(2)(3)处的语句依次是( )
A、①②③ B、①③② C、③①② D、②③①17. 有以下VB程序段:For i = 1 To 4
For j = 4 To i + 1 Step -1
s = "*" + s
Next j
List1.AddItem s
Next i
运行上述程序段后,列表框List1中显示的结果是( )
A、 B、 C、 D、18. 数组b是一个有重复数据的递增数组,现把前面n个元素整体移动到最后形成如“7,8,9,10,1,2,3,4”的排列形式。下列程序实现如下功能:输入一个数,利用对分查找算法在数组b中查找,返回查找结果在Label2输出,若有多个相同数据,则返回最左侧数据的位置。Dim b(1 To 20) As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer, m As Integer
i = 1: j = 20
Key = Val(Text1.Text)
Do While (1)
m = (i + j + 1) \ 2
If b(i) < b(m) Then
If (2) Then
j = m - 1
Else
i = m + 1
ElseIf Key = b(m) Then
Exit Do
Else
If Key > b(m) And Key <= b(j) Then
i = m + 1
Else
j = m - 1
End If
Loop
If (3) Then
Label2.Caption = "数组中无此数"
Else
Do While m > 0
If Key = b(m) Then m = m - 1 Else Exit Do
Loop
Label2.Caption = "此数在第" + Str(m + 1) + "个位置"
End If
End Sub
(1)、(2)(3)处可选语句为:①i > j
②i <= j
③Key < b(m) And Key >= b(i)
④Key> b(m) And Key <=b(j)
则(1)(2)(3)处的语句依次是( )
A、①③② B、②④① C、②③① D、①④②19. 有如下VB程序段:a(1) = 1: a(2) = 3: a(3) = 5: a(4) = 7: a(5) = 9
s = "ICT2019reform"
For i = 1 To 5
t = a(i)
s = Mid(s, 1, t - 1) + Mid(s, t + 1)
Next i
Text1.Text = s
执行该程序段后,Text1显示的是( )
A、ICT2019re B、CT01reor C、C21rform D、CT01reorm20. 有如下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 521. 某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、orldo22. 某VB程序段如下:s = "491053"
For i = 1 To 3
n = Len(s)
k = 1
For j = 2 To n
If Mid(s, k, 1) >= Mid(s, j, 1) Then
k = j
Else
Exit For 'Exit For表示退出循环
End If
Next j
s = Mid(s, 1, k - 1) + Mid(s, k + 1, n - k)
Next i
Label1.Caption = s
执行该程序段后,标签Label1中显示的值是( )
A、053 B、953 C、913 D、10323. 有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、324. 有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、20,9,18,23,4,7 C、22,7,0,15,4,19 D、6,0,4,21,18,1725. 有如下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、1226. 某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,23