好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

vb考前辅导模拟试卷四(中等).doc

10页
  • 卖家[上传人]:第***
  • 文档编号:32840884
  • 上传时间:2018-02-12
  • 文档格式:DOC
  • 文档大小:221.50KB
  • / 10 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 17VB 考前模拟试卷四(中等)试题 1(每小题 2 分,共 8 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案程序说明】运行时先在文本框 Text1 中输入 n 的值后回车,如果值在[1,10]之间,则清空文本框 Text2,并使它获得焦点然后在在文本框 Text2 中输入正确的 a 值后按回车,将以下和式的计算结果 S 显示在结果文本框 Text3 中S = a + a a + a a a + … + a a … an 个 a【程序】Dim n As BytePrivate Sub Text1_KeyPress(KeyAscii As Integer)n = Val(Text1.Text)If KeyAscii = 13 And    (1)  ThenText2.Text = ""Text2.SetFocusEnd IfEnd SubPrivate Sub Text2_KeyPress(KeyAscii As Integer)Dim a As Byte, i As ByteDim s As Long, tx As LongIf    (2)   ThenExit SubEnd Ifa = Val(Text2.Text)If a 9 ThenExit SubEnd Iftx = a(3)   For i = 2 To n(4)   s = s + txNext iText3.Text = Str(s)End Sub【供选择的答案】(1)A.n > 0 And n = 0 And n = 1 Or n 0 And n 13C.KeyAscii = "\n" D.KeyAscii "\n"(3)A.s = tx B.tx = s C.s = 0 D.s = a * 10 + a(4)A.tx = a * 10 + a B.tx = tx + a C.tx = tx * a + a D.tx = tx * 10 + a试题 2(每小题 2 分,共 8 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。

      程序说明】抽奖程序界面如图,先模拟生成 1000 个身份证号放在数组 A 中,运行时标签框(Label1)中显示第一个身份证号,单击“开始”命令按钮(Command1)后,命令按钮改标题改为“停止” ,标签框以每隔 0.1 秒顺序变化显示数组中的身份证号,单击“停止”按钮身份证号变动停止,同时按钮标题改为“开始” 程序】(5) Dim A(0 To 999) As StringPrivate Sub Command1_Click()If Command1.Caption = "开始" Thenn = 0(6) Command1.Caption = "停止"ElseTimer1.Enabled = FalseCommand1.Caption = "开始"End IfEnd SubPrivate Sub Form_Load()Timer1. Interval = (7) Timer1.Enabled = FalseFor i = 0 To 999A(i) = ""For j = 1 To 18A(i) = A(i) + Trim(Str(Int(Rnd * 10))) '模拟身份证号Next jNext iLabel1.Caption = A(0)End SubPrivate Sub Timer1_Timer()19n = (n + 1) Mod 1000(8) End Sub【供选择的答案】(5)A.Option Base 1 B.Option Base 0C.Dim n As Integer D.Option Explicit(6)A.Timer1.Enabled = False B.Timer1.Enabled = TrueC.Timer1.Interval = 100 D.Timer1.Interval = 10(7)A.10 B.100 C.1000 D.10000(8)A.Label1.Caption = Str(A(n)) B.Print A(n)C.Print Str(A(n)) D.Label1.Caption = A(n)试题 3(每小题 2 分,共 6 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。

      程序说明】运行时在文本框(Text1)中输入一个字符串后单击“循环左移”按钮(Command1) ,在列表框中显示字符串循环左移一周的结果,注意第一个与最后一个都是原字符串程序】Private Sub Command1_Click()Dim ss As String, tt As StringDim ll As Integerss = Text1.Textll = Len(ss)(9)   DoList1.AddItem ssss =    (10)   Loop While ss tt(11)   End Sub【供选择的答案】( 9)A.tt = "" B.ss = tt C.tt = ss D.tt = Right(ss, ll - 1)20(10)A.Right(ss, 1) + Left(ss, ll - 1) B.Left(ss, 1) + Right(ss, ll - 1)C.Mid(ss, 2, ll - 1) D.Right(ss, ll - 1) + Left(ss, 1)(11)A.List1.RemoveItem 0 B.List1.Text = ssC.List1.AddItem ss D.List1.List(ListCount - 1) = ss试题 4(每小题 2 分,共 8 分)阅读下列程序,在每小题提供的若干可选答案中,挑选一个正确答案。

      程序】Dim x As Integer, k As Integer, n As IntegerPrivate Sub Form_Click()Static k As IntegerDim m As Integerk = k + 2m = m + 1n = n + 1Call proc(k , m) '第 8 行Print k; m; nproc k, nPrint k; m; nEnd SubPrivate Sub proc(x As Integer, y As Integer) '第 13 行Dim t As Integert = x: x = y: y = tEnd Sub【供选择的答案】(12)单击窗体一次后在窗体上打印的结果为A.1 2 1 B.1 2 1 C.2 1 1 D.1 2 31 2 3 1 2 1 2 1 1 1 1 2(13)如果再单击窗体一次,则第二次单击后在窗体上新打印的内容为A.1 2 2 B.4 1 2 C.2 1 2 D.1 3 22 2 1 4 1 2 2 1 2 2 3 1(14)如果将程序的第 8 行改为 Call proc(k + 1, m),再单击窗体一次后在窗体上打印的结果为A.2 3 1 B.1 3 1 C.2 1 2 D.2 1 11 3 2 1 3 1 1 3 2 2 3 1(15)如果将程序的第 13 行改为 Private Sub proc(ByVal x As Integer, y As Integer),再单击窗体一次后在窗体上打印的结果为A.2 2 1 B.1 2 1 C.1 1 1 D.4 4 32 2 2 1 2 1 1 1 1 4 4 4试题 5(每小题 2 分,共 8 分)阅读下列程序,在每小题提供的若干可选答案中,挑选一个正确答案。

      程序】Private Sub Command1_Click()21Dim a As Integer, b As Integer, x As Integera = Val(InputBox("a ="))b = Val(InputBox("b ="))x = aDo While Not (x Mod a = 0 And x Mod b = 0)x = x + aLoopPrint xEnd Sub【供选择的答案】(16)单击 Command1 依次输入 8、6 后,显示:A.2 B.24 C.14 D.1(17)单击 Command1 依次输入 28、16 后,显示:A.44 B.1 C.112 D.4(18)单击 Command1 依次输入 3、5 后,显示:A.15 B.1 C.8 D.125(19)单击 Command1 依次输入 5、12353 后,显示:A.空白 B.1 C.0 D.出错试题 6(每小题 2 分,共 8 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案程序说明】运行时产生 10 个在[10,99]之间的随机整数后,从小到大输出其中较小的 5个。

      程序】Private Sub Command1_Click()Dim a(1 To 10) As IntegerDim t As Integer, i As Byte, j As Byte, k As ByteFor i = 1 To 10a(i) = (20) Next iPrint "其中最小的 5 个数依次为:";For i = 1 To      (21)     k = iFor j = i + 1 To 10If     (22)    Then k = jNext jt = a(i): a(i) = a(k): a(k) = t(23) Next iEnd Sub【供选择的答案】(20)A.Int(Rnd * 90) + 9 B.Int(Rnd * 100) C.Int(Rnd * 99) + 10 D.Fix(Rnd * 90) + 10(21)A.6 B.10 C.9 D.522(22)A.a(k) > a(j) B.a(k) a(j) D.a(i) Max Then Max = yIf (34) Then Max = zEnd FunctionPrivate Sub Command1_Click()Dim a As Integer, b As Integer, c As Integer, d As Integer, e As IntegerDim M As Integera = 11: b = 23: c = 98: d = 5: e = 45Print a; b; c; d; eM = (35) Print MEnd Sub【供选择的答案】(32)A.As Sigle B.空白C.As Integer D.As String(33)A.Max = y B.Max = z C.Max = x D.Max = 0(34)A.z > Max B.z y D.z < y(35)A.Call Max(Call Max(a, b, c), d, e) B.Max(Max(a, b, c), Max(d, e,0))C.Max Max(a, b, c), d, e D.Max(Max(a, b, c), d, e)试题 10(共 10 分)有一个函数:y =x ( x < 1 ) 2 x - 1 ( 1 ≤ x < 1 0 ) ex / 2( x ≥ 1 0 ) 编程实现以下功能:单击窗体(Form1)时,由 InputBox 函数输入一个。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.