智慧树知到《VisualBasic程序设计(吉林医药学院)》章节测试答案

答案网www.qiansejidi.com为你分享智慧树知到《VisualBasic程序设计(吉林医药学院)》章节测试答案,智慧树 知到 VisualBasic程序设计的相关攻略:智慧树知到《VisualBasic程序设计(吉林医药学院)》章节测试答案第一章章节测试1、以下关于VB语言的说法中,正确的是()。A:VB是一种面向过程的语言B:VB是一种面向对象的语言C:VB是一种低级语言D:VB是一种机器语言正确答案:VB是一种面向对象的语言2、在Visual Basic环境下,当写一个新的Visual B


3、有如下函数过程:Function secproc(x As Integer, y As Integer, z As Integer) secproc = 3 y + z + 2 xEnd Function Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a = 2: b = 3: c = 4 Print secproc(c, b, a)End Sub该程序的运行结果是()。

A:17

B:18

C:19

D:20

正确答案:19

4、有如下函数过程:Function Cys(ByVal x As Integer, ByVal y As Integer) As Integer Dim quotients Do While y <> 0 quotients = x / y x = y y = quotients Loop Cys = xEnd Function以下是调用该函数的事件过程,该程序的运行结果是()。Private Sub Command1_Click() Dim a As Integer Dim b As Integer a = 10 b = 2 x = Cys(a, b) Print xEnd Sub

A:0

B:25

C:5

D:100

正确答案:5

5、以下是一个能返回数组a中最大数的函数过程代码: Function maxval(a() As Integer) As Integer Dim max% max = 1 For i = 2 To 10 If a(i) > a(max) Then max = i Next i maxval = max End Function Private Sub Command1_Click() Dim x(1 To 10) As Integer For i = 1 To 10 x(i) = Int(Rnd() 100) Print x(i); Next i Print Print maxval(x())End Sub程序运行时,发现函数过程的返回值是错的需要修改,下面的修改方案中正确的是()。

A:语句“max = 1”应改为“max = a(1)”

B:语句“For i = 2 To 10”应改为“For i = 1 To 10”

C:If语句“max = i”应改为“max = a(i)”

D:语句“maxval = max ”应改为“maxval = a(max)”

正确答案: D

6、在窗体上画一个命令按钮(名称为Command1),并编写如下代码:Function Fun1(ByVal a As Integer, b As Integer) As Integer Dim t As Integer t = a – b b = t + a Fun1 = t + bEnd Function Private Sub Command1_Click() Dim x As Integer x = 10 Print Fun1(Fun1(x, (Fun1(x, x – 1))), x – 1)End Sub程序运行后,单击命令按钮,输出结果是()。

A: 10

B: 0

C: 11

D: 21

正确答案: B

7、下面程序的运行结果为()。Dim a%, b%, c%Sub p1(x%, y%) Dim c As Integer x = 2 x: y = y + 2: c = x + yEnd SubSub p2(x%, ByVal y%) Dim c As Integer x = 2 * x: y = y + 2: c = x + yEnd SubPrivate Sub Command1_Click() a = 2: b = 4: c = 6 Call p1(a, b) Call p2(a, b) Print a; b; cEnd Sub

A: 4 6 6

B: 8 6 6

C: 4 6 10

D: 8 8 6

正确答案:8 6 6

8、下面程序:Function a(x) Static b As Integer b = b + x ^ 2 Print bEnd Function Private Sub Command1_Click() Dim c% c = a(2)End Sub单击两次命令按钮,第二次显示的结果是()。

联系我们

联系我们

查看联系方式

邮箱: 2643773075@qq.com

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部