资源预览内容
第1页 / 共10页
第2页 / 共10页
第3页 / 共10页
第4页 / 共10页
第5页 / 共10页
第6页 / 共10页
第7页 / 共10页
第8页 / 共10页
第9页 / 共10页
第10页 / 共10页
亲,该文档总共10页全部预览完了,如果喜欢就下载吧!
资源描述
.Visual Basic程序设计基础试题一(每小题2分,共10分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】过程JiSuan用于计算e = 1 + 1/1! + 1/2! + 1/3! + +1/n!的值,直至末项小于0.00001(不包含小于0.00001的项),并用消息框显示结果。【程序】Option ExplicitPrivate Sub JiSuan() Dim e As single, (1) , i As long e = 1: t = 1: (2) (3) i = i + 1: e = e + t: (4) Loop (5) End Sub【供选择的答案】(1) A、t As String B、Dim t As String C、Dim t As Single D、t As Single(2) A、i = 1 B、i = 2 C、i = 0 D、i = 3(3) A、While t = 0.00001 B、Do While t = 0.00001C、While e = 0.00001 D、Do While e = 0.00001(4) A、t = t * i B、t = 1/(i * t) C、t = t / i D、t = 1 / i(5) A、MsgBox 近似值为: + tB、MsgBox 近似值为: & tC、MsgBox 近似值为: + eD、MsgBox 近似值为: & e试题二(每小题2分,共8分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】程序界面如下图所示,程序运行时要求有以下功能:1. 单击“加粗”复选框(Check1),若复选框被选中,则设置标签(Label1)上显示的文字为加粗,否则设置为不加粗。2. 单击“选择颜色”按钮(Command1)将显示“颜色”对话框,若单选按钮“前景色”(Option1)被选中,则设置Label1的前景色为用户选择的颜色,否则设置Label1的背景色为用户选择的颜色。通用对话框控件名称为CommonDialog1。【程序】Private Sub Check1_Click() Label1.FontBold = False If (6) Then Label1.FontBold = TrueEnd SubPrivate Sub Command1_Click() Dim c As Long : (7) : c = (8) If (9) Then Label1.ForeColor = c Else Label1.BackColor = cEnd Sub【供选择的答案】(6) A、Check1.Value = True B、Check1.Value = FalseC、Check1.Value = 1 D、Check1.Value = 0(7) A、CommonDialog1.ShowOpen B、CommonDialog1.ShowColorC、CommonDialog1.ShowSave D、CommonDialog1.Action = 1(8) A、CommonDialog1.ForeColor B、CommonDialog1.FontColorC、CommonDialog1.BackColor D、CommonDialog1.Color(9) A、Option1.Value B、Option1.Value = 1C、Option1.Value = false D、Option1.Value = 0试题三(每小题2分,共10分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】 程序界面如上面两图所示,程序运行时要求有以下功能:1. 当用户单击“增加”按钮(Command1),若文本框(Text1)中的内容不为空,则将文本框中的内容添加到列表框末尾,并自动将文本框中的内容选中。2. 当用户单击“删除”按钮(Command2),若列表框中没有表项被选中,则用消息框提示“没有选择表项”,否则删除被选中的表项。3. 文本框仅允许输入数字字符与退格字符(ASCII码值为8)。【程序】Private Sub Command1_Click() Dim s As String, t As Strings = Text1.Text If s = Then Exit Sub (10) : Text1.SetFocus Text1.SelStart = 0: (11) End SubPrivate Sub Command2_Click() If List1.ListIndex = -1 Then MsgBox 没有选择表项 Else (12) End SubPrivate Sub Text1_ (13) If (14) Then KeyAscii = 0End Sub【供选择的答案】(10) A、List1.AddItem s,List1.ListCount B、List1.AddItem s, 0C、List1.AddItem s, List1.ListCount - 1 D、List1.AddItem s;0(11) A、Text1.SelLength = Len(Text1.Text)B、Text1.SelLength = Len(Text1.SelText)C、Text1.SelText = Text1.TextD、Text1.Text = Text1.SelText(12) A、List1.RemoveItem List1.TextB、List1.RemoveItem List1.ListCountC、List1.RemoveItem List1.ListIndex 1D、List1.RemoveItem List1.ListIndex(13) A、KeyPress(KeyAscii As Integer) B、Change(KeyAscii As Integer)C、Change D、KeyPress(KeyAscii As String)(14) A、(KeyAscii Asc(9) or KeyAscii Asc(9) And KeyAscii Asc(9) or KeyAscii Asc(0) And KeyAscii 8D、KeyAscii Asc(9) and KeyAscii Asc(0) and KeyAscii 8试题四(每小题2分,共14分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】程序界面如下图所示,程序运行时要求有以下功能:1. 单击“排序”按钮(Command1),将左边文本框(Text1)中的字符按从小到大的顺序排列,并显示到右边文本框(Text2)中。【程序】Private Sub Command1_Click() Dim s As String, c() As String, slen As Integer Dim i As Integer, j As Integer, p As Integer s = Trim(Text1.Text) slen = _ (15) : _ (16) For i = 1 To slen c(i) = _ (17) Next i For i = 1 To slen - 1 p = i For j = _ (18) If _ (19) Then p = j Next j If p i Then _ (20) Text2.Text = Text2.Text + c(i) Next i Text2.Text = _ (21) End SubPrivate Sub swap(a As String, b As String) Dim t As String: t = a: a = b: b = tEnd Sub【供选择的答案】(15) A、Len(s) B、Val(s) C、Asc(s) D、Length(s)(16) A、ReDim c() B、Dim c() as string C、ReDim c(1 to slen) D、Dim c(1 to slen)(17) A、Mid(s,i) B、Left(s,i) C、Mid(s,i,1) D、Asc(Mid(s,i,1)(18) A、1 to slen-i B、i+1 to slen C、i to slen-1 D、1 to slen(19) A、c(p)c(j) B、c(p)c(j) C、c(i)c(j)(20) A、swap c(p),c(i) B、Call swap c(p),c(i)C、swap c(p),c(j) D、Call swap(c(p),c(j)(21) A、Text2.Text + c(j) B、Text2.Text + c(i)C、c(j) D、c(i)试题五(每小题2分,共8分)阅读下列程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】Dim a As BytePrivate Sub Form_click() Dim a As Byte (1) a = a + 2 Call aa(a) (2) Print a;End SubSub aa(b As Byte) (3) b = a + 2End Sub【供选择的答案】(22) 单击窗体两次后,窗体上显示的内容是什么?A、0 0 B、2 2 C、2 4 D、4 8(23) 其它代码不变,仅将程序中的语句(1)前面的单引号“”删除,单击窗体两次后,窗体上显示的内容是什么?A、0 0 B、2 2 C、2 4 D、4 8(
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号