《浙江省信息技术学考VB模块基础检测(附参考答案)(8页).doc》由会员分享,可在线阅读,更多相关《浙江省信息技术学考VB模块基础检测(附参考答案)(8页).doc(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-浙江省信息技术学考VB模块基础检测(附参考答案)-第 8 页VB模块基础检测(高一) 班级 姓名 分数 一、选择题(本大题共20小题,每小题3分,共60分)每小题4个选项中只有一个符合题目要求,不选、错选、多选均不得分。请将选项直接写在各小题相应位置。1某算法的自然语言描述与流程图表示分别如下:第1步:输入一个实数x第2步:判断x与0的大小关系,若x0,则y=x2-1,否则y=2x-1第3步:输出y第4步:结束则流程图中空白处理框和处应填入的是( )A y x2 1 x 2x 1B y x2 1 y 2x 1C y 2x 1 y x2 1D x x2 1 y 2x 12字符串变量a的值为“H
2、ello,world!”,下列VB表达式的值是“world”的是( )ALen(a)BMid(a, 6, 5)CMid(a, 7, 4)DMid(a, 7, 5)3产生-20,20 范围内某一随机整数的表达式是( )AInt(Rnd * 41) BInt(Rnd * 41) - 20CInt(40 * Rnd) - 20DInt(-40 * Rnd) + 204在VB中,若a = 4,b = 3,语句If a b Then a = a - 2 Else b = b + 1执行后,下列说法正确的是( )A执行了语句a = a - 2B先执行a = a - 2,再执行c = b + 1C执行了语句
3、b = b + 1D先执行b = b + 1,再执行a = a - 25数学表达式1 b 100写成VB表达式,正确的是( )A1 = b = 100B1 b 100C1 = b And b = 100D1 = b Or b = 100第6题图6在VB代码编辑窗口中,输入了“List1.”后出现了如第6题图所示的信息,其中的“Clear”是List1的( )A属性名B事件名C对象名D方法7在VB数组说明语句Dim a(11) As Single中,数组a的元素个数是( )A0B12C1D118下列VB表达式的值等于100的是( )AVal(96) + 4 BLen(40) + 60 CSqr(
4、81) + 19 DStr(20) + 809若x为正整数,同时能被5整除,则下列VB表达式的值一定为真的是( )Ax / 5 = 0Bx Mod 5 = 0 CInt(x 5) = 0 D5 Mod x = 010若x、y都是正整数,且关系表达式x y = 1为真,则下列VB表达式值一定为真的是( )Ax Mod y = 0Bx = y And x a(i) Then m = a(i) Next i该程序段执行后,变量m中存储的是( )Aa(1)至a(10)中的最大值Ba(1)至a(10)中的最小值Ca(2)至a(10)中的最大值Da(2)至a(10)中的最小值13某VB程序段如下: Dim
5、 a(1 To 20) As Integer Dim i As Integer a(1) = 1 For i = 1 To 20 a(i) = a(i - 1) * i Next i运行该程序段,首先会出现的错误提示为( )A下标越界B子程序或函数未定义C要求对象D溢出14已知文本框对象Text1的Text属性值发生改变时,会驱动下面事件处理过程 Private Sub Text1_Change() If Val(Text1.Text) 500 Then Text1.Text = Text1.Text + 2 End Sub开始时,在Text1中输入6,Text1最后显示值是( )A622B2
6、222C62D22615. 某VB程序的代码如下:Private Sub Command1_Click() a=Val(Text1.Text) b=Val(Text2.Text) s=a*b Label1.Cap=Str(s) End Sub运行程序,单击命令按钮Command1后弹出图中所示出错信息提示,引起该错误的语句是( )A a=Val(Text1.Text) Bb=Val(Text2.Text) Cs=a*b DLabel1.Cap=Str(s)16. 下列V B表达式中,值为字符串型的是 ( )str(x) Text1.text Label1.Height Chr(x) Asc(x
7、)A BC D17下列能计算Sum = 1 + 2 / 3 + 3 / 5 + + 50 / 99的VB程序段是( )ASum = 1 For i = 1 To 49 Sum = Sum + i / (2 * i - 1) Next iBSum = 0 For i = 1 To 99 Sum = i / (2 * i - 1) Next iCSum= 0 i = 1 Do While i = 50 Sum = Sum + i / (2 * i - 1) i = i + 1 LoopDSum= 0 i = 1 Do While i = 50 Sum = Sum + i / (2 * i - 1)
8、 Loop18对称字符串的特征是从左到右读和从右到左读完全一样的。如“abba”是对称的,“abcba”也是对称的。判断字符串是否对称的VB程序段如下:Dim n As Integer, i As Integer, j As Integer, k As IntegerDim s As String, c1 As String, c2 As Strings = Text1.Textn=Len(s)k=0 : j=nFor i = 1 To n/2Next iIf k = 0 Then Label1.Caption =对称 Else Label1.Caption= 不对称方框中的代码由以下三部分组
9、成: j = j - 1 If c1 c2 Then k = k + 1 c1= Mid(s,i,1) : c2 = Mid(s,j,1)代码顺序正确的选项是ABCD19某数列前三项分别为:a1 = 2、a2 = 3、a3 = 4,以后每项都满足:ak = ak-3 + ak-1 (k3),如果用数组a存储该数列的前10项,请你完善该程序段,并输出结果( )Dim a(10) As Integer, k As Integer a(1) = 2 : a(2) = 3 : a(3) = 4 For k = _ To 10 a(k) = a(k - 3) + a(k - 1)Next kPrint
10、a(10)A4 60B3 41C5 11D4 1120以下VB程序的功能是:计算表达式12345678910的值,并在文本框Text1中输出结果。为了实现这一功能,下面程序段划线处应填入( )Private Sub Command1_Click()Dim i As Integer,sum As Long_For i = 1 To 10 sum = sum * iNext iText1.Text=Str(sum)End SubAi=0Bi=1Csum=0Dsum=1二、综合题(本大题共10小题,每小题4分,共40分)21 表达式表述及其计算(共4分)(1)计算9 + 13 5 * 11 / 4
11、Mod 5的值: (2分)(2),该VB表达式修正为: (2分)22下列VB程序运行时,在文本框Text1中输入“Basic”,单击命令按钮Command1后,文本框Text2中显示的内容是 。(4分)Private Sub Command1_Click() Dim i As Integer, n As Integer Dim s1 As String, s2 As String, c As String s1 = Text1.Text s2 = n = Len(s1) For i = 1 To n c = Mid(s1, i, 1) s2 = c + s2 Next i Text2.Text
12、 = s2End Sub23为使左、右框内的VB程序段能实现相同的功能:(共4分)Private Sub Command1_Click() Dim i As Integer, s As Long s = 0 For i = 1 To 50 s = s + 2 * i - 1 Next i Text1.Text = Str(s)End SubPrivate Sub Command1_Click() s = 0: t = 1 Do While _(2分) s = s + t t = _ (2分) Loop Text1.Text = Str(s)End Sub右框内划线处的内容可以是 、 。24有V
13、B程序段如下:(4分)Dim i As Integer, j As Integer, k As String, n As Integern = 3 List1. Clear For i = 1 To nk =For j = 2 * i - 1 To 1 Step -2k = k + * Next jList1. AddItem k Next i该程序段运行后,请在下面方框内写出列表框List1中显示的内容。25有VB程序段如下:(4分) Dim a(1 To 10) As IntegerDim k As Integer, i As Integer, c As Integer a(1) = 2:
14、 a(2) = 11: a(3) = 7: a(4) = 14: a(5) = 25 c = 0 For i = 6 To 10 If a(i - 3) + a(i - 2) 0 If n Mod 2 = 1 Then t = t + 1 Else k = (2分) n = n 2 Loop If Then s = s + 1 (2分) Next i Text1.Text = Str(s)End Sub28. 有VB程序段,Command1的事件处理过程如下(4分) Private Sub Command1_Click()Dim s As Integer, i As Integer ,n As
15、 Integers=0n=Val(Text1.Text)For i 5 To 1 Step -2 s= s+nNext iText1.Text= Str(s)End Sub程序运行时在文本框Text1中输入7,连续单击两次Command1按钮后。在文本框Text1中的内容为 (4分)29. 有VB程序段如下:(4分)Private Sub Command1_Click()Dim i As Integer , a As Integer, b As Integera=0: b=0For i 0 To 350 Step 3 If i Mod 3=0 Then a= a+i b= b+1 End If
16、Next iLabel1.Caption= Str(a) Label2.Caption= Str(b)End Sub程序运行时,单击按钮Command1后,在标签Label1中显示的内容是 ,(2分)Label2中显示的内容是 (2分)30二进制转换为十进制可采用按权展开相加法:如:(1101)2=123+122+021+120=(13)10现用VB编写一个转换程序,功能如下:在文本框Text1中输入二进制编码,单击“转换”按钮Command1,程序将从左到右依次取出二进制数字字符,同时将该字符转换为数值,并乘以相应的权值后累加求和,最后在标签框Label1中输出转换后的十进制数值。程序运行效
17、果如右图所示。(共4分)Private Sub Command1_Click() Dim code2 As String 存放二进制 Dim code10 As Long 存放十进制 Dim changdu As Integer, bit As Integer, i As Integer code2 = Text1.Text code10 = 0 changdu = (2分) For i = 1 To changdu bit = (2分) code10 = code10 + bit * Val(Mid(code2, i, 1) Next i Label1.Caption = Str(code1
18、0)End Sub VB模块基础检测答案参考(高一)一、选择题(本大题共20小题,每小题3分,共60分)每小题4个选项中只有一个符合题目要求,不选、错选、多选均不得分。请将选项直接写在各小题相应位置。12345678910BDBACDBABD11121314151617181920DBAADBCCAD二、综合题(本大题共10小题,每小题4分,共40分)21.(1)9(2)(-b+sqr(b2-4*a*c)/(2*a) 没有其他不同答案,注意乘号写错不给分,分母括号没写不给分。22. cisaB23. (1)t=99(或t 0 And i Mod 15 = 0 Then sum = sum + i ) (或 i Mod 2 = 1 And i Mod 3 = 0 And i Mod 5 = 0 Then sum = sum + i) (或 i Mod 2 0 And i Mod 3 = 0 And i Mod 5 = 0 Then sum = sum + i)27. (1) k = k + 1 (2) t k (或 k t)28. 6329. (1)20358(2)11730. (1)len( code2 )(2)2 ( changdu - i )