粤教版(2019) 必修1第四章 程序设计 综合复训练
选择题
1.range(110)取值范围( )
A.110 B.19 C.010 D.09
2.统计字符串s中升序段数(例47923123满足条件升序段47923123)编写部分VB程序段:
s 47923123
fTruenLen(s)m0
For i2 To n
If Mid(si1)>Mid(si11)Then
Else
End If
Next i
Text1 Text升序段数+Str(m)
述程序段中方框处选语句:
①f True
②f False
③If f Then mm+1
(1)(2)(3)处语句次( )
A.①②③ B.②③① C.③②① D.③①②
3.运行列Python程序
i1
s1
while ①
ss*i
i+2
print(s)
输出结果105时①处应填入( )
A.i<7 B.i<7 C.i>7 D.i>7
4.选择排序思想:设计数组a进行剔重复数升序排序程序实现该功VB程序段:
i1
bottomn 'na数组元素数
Do While i
For jbttom Toi+1 Step1
If a(j)kj
ElseIf a(j)a(k)Then
If (1) Then (2) Else (3)
bottombttom1
End If
Next j
If k <>I Then ta(k) a(k)a(i) a(i)t
ii+1
Loop
述程序中方框处选语句:
①kj②kbottom③a(j)a(bottom)
(1)(2)(3)处语句次( )
A.②①③ B.②③① C.③①② D.①②③
5. VB 程序段:
a(1) 58 a(2) 38 a(3) 46 a(4) 40 a(5) 58
a(6) 30 a(7) 48 a(8) 50 a(9) 36 a(10) 56
For i 1 To 10
b(a(i) mod 10) b(a(i) mod 10) + 1
Next i
s
For i 0 To 9
If b(i) > 0 Then s s+ +str(i)+ + Str(b(i))
Next i
数组 b 元素初值 0执行该程序段s 值( )
A.3:4 4:3 5:4 B.8:4 6:3 0:3
C.5:4 4:3 3:4 D.0:3 6:3 8:4
6.列选项中变量a赋值三项等价( )
A.a abs(ab)
B.if a>b Thena b Else aba
C.If a> bThen aab If aD.a ab If a<0 Then aa
7.变量ab值分24a+bab值( )
A.3 B.0 C.4 D.1
8.某算法部分流程图图示:
VB语言实现该部分算法列代码正确( )
A. B. C. D.
9.面程序段运行结果( )
s0
for i in range(162):
ss+i
print(s)
A.15 B.10 C.12 D.9
10.程序段:
Function delStr(S As String m As Integer) As String
Dim n As Integer n Len(S)
If m < 1 Or m > n Then delStr 输入位置误
If m 1 Then delStr Mid(S 2 n 1)
If m < n Then delStr Mid(S 1 m 1) + Mid(S m + 1 n m)
If m n Then delStr Mid(S 1 n 1)
End Function
Private Sub Command1_Click()
Dim S As String Dim i As Integer
S Text1Text
For i 1 To 10 Step 2
S delStr(S i)
Next i
Text2Text S
End Sub
文框 Text1 中输入 Happybirthday执行该程序段文框 Text2 中显示( )
A.apybrtda B.apbrhday C.Happybirhday D.day
11.Python中程序运行结果( )
(1)import turtle as mypen
(2)for x in range(400-10):
(3) mypencircle(x)
(4) mypendone()
A. B. C. D.
12.VB程序段:
Dim d(1 to 5)as integeri as integer
Dim flag as Booleanj as integer
数组元素d(1)d(5)赋初值1代码略
Randomize
For i1 to 5
J lflag True
d(i) int(Rnd*9)
Do while j< i1 and flag True
d(i) int(Rnd*5+1)
If d(i) d(j) then iilflag False
j j+1
Loop
Next i
运行程序数组中数值( )
A.1 3 4 5 6 B.3 5 4 1 1 C.8 3 1 2 5 D.1 2 6 2 1
二填空题
13.阅读程序分析代码回答问题
list['a''b''c''d''e''f''g']
list1[]
list2[]
for i in range(7)
if i20
list1append(list[i])
else
list2append(list[i])
print(list1)
print(list1)
(1)list 数类型 _______
(2)list中元素数类型 ________
(3)list1[]作 _______
(4)for i in range(7)语句中i 实际数范围_____ ____
(5)append(list[i])作______
14.numpy科学计算包中包括________________矩阵计算方法________线性代数等
15.根程序代码完成列题
程序描述: 谓角谷猜想指意正整数果奇数3加1果偶数2结果述规重复处理终总够1假定初始整数5计算程分168421
程序求输入正整数(1)处理1程输出代码:
xint(input('输入正整数:'))
while ①
if ②
xx2
③
el se
④
③
if x1
⑤
①处语句(_______) ②处语句(______)③处语句(_____)④处语句(______)⑤处语句(_____)
(1)A.x>1 B.x>2 C.x1: D.x0:
(2)A.x30 B.x20 C.x30 D.x20
(3)A.print(x2’) B.print(x’) C.print(x) D.print(x2)
(4)A.x x2 B.x x2+1 C.xx*3+1 D.x3x+1
(5)A.pass B.exit C. continue D.break
16.Python语言实现加密算法时明文密文抽象_________类型数
三判断题
17.n6m3表达式m+3n and n3>m值true(______)
18.常见序结构语句输入语句输出语句赋值语句(______)
19. Python语言环境表达式132+72值45 (_____)
20.python语言种面象解释型计算机程序设计语言发明1989年目前python已成受欢迎程序设计语言 (_____)
参考答案
选择题
1.B
2.C
3.A
4.A
5.D
6.C
7.B
8.B
9.D
10.A
11.D
12.C
二填空题
13.列表 字符型 定义空列表 0 6 list中添加元素
14.数学函数 矢量运算 三角函数
15.C D C C D
16.字符串
三判断题
17.正确
18.正确
19.错误
20.
文档香网(httpswwwxiangdangnet)户传
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档