9、下列代码的运行结果为() def test_scope(): variable=100 print(variable,end=',') def func(): print(variable,end=',') func() varialbe=300 test_scope() print(varialbe)
A.100,300,300
B.100,100,100
C.100,100,300
D.抛出异常
第1题:
下列块结构条件语句,正确的是( )。
A.If x>10 Then print"a" Else if x>5 Then print"b" Else if x<5 Then print"c" End if
B.if x>10 Then print"a" Else if x>5 Print"b" Else Print"c" End if
C.If x>10 Then print"a" Else if x>5 Then print"b" Else x<5 Then Print"c" End if
D.If x>10 Then Print"a" Else if x>5 Then print"b: Else Print"c" End if
第2题:
(27)下列函数过程 Function Func(a As Integer,b As Integer)As Integer Static m As Integer,i As Integer M=0 i=2 A=i+m+1 b=i+a+b Func2=m End Function Private Sub Command1_Click() Dim p As Integer,k As Integer,m As Integer k=4 m=1 P=Func2(k,m) Print k;m End Sub程序运行后,单击命令按钮,输出结果是 A.3 6<CR>3 6 B.3 6<CR>3 11C.3 11<CR>3 6 D.3 11<CR>3 11
第3题:
第4题:
阅读下列程序: Function func(n As Integer)As Integer Sum = 0 For i = 1 To n Sum = Sum + (i + 1)* i Next i func = Sum End Function.Private Sub Command1_Click () Dim a As Integer a= 5 s = func (A)Print s End Sub 程序运行后,单击命令按钮,输出的结果为
A.80
B.60
C.70
D.15
第5题:
下列程序段的执行结果为 a=2 b=0 Select Case a Case 1 Select Case b Case 0 Print " * * 0 * *" Case 1 Print" * * 1 * *" End selec Case 2 Print " * * 2 * *" End Select
A.* * 0 * *
B.* * 1 * *
C.* * 2 * *
D.0
第6题:
假定有如下的Sub过程: Sub Func(x As Single, y As Single) t=x x=t/y y=t Mod y End Sub 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim a As Single Dim b As Single a=6 b=5 Func(a, B) Print a, b End Sub 程序运行后,单击命令按钮,输出结果为 ______。
A.6 5
B.1 1
C.1.2 5
D.1.2 1
第7题:
下列程序段的执行结果为 m=1 n=1 Select Case m Case 1 Select Case n Case 0 print"A" Case 1 Print"B" End Select Case 2 Print"C" End Select
A.A
B.B
C.C
D.0
第8题:
下列程序段的执行结果为 m=1 n=1 Select Case m Case 1 Select Case n Case 0 Print" * * 0 * *" Case 1 Print" * *1* *" End Select Case 2 Print" * * 2 * *" End Select
A.**0**
B.**1**
C.**2**
D.0
第9题:
下列程序段,运行后输出的内容是 a=2 c=1 c=c+a If c<10 Then Print c Else Print a End If
A.3
B.7
C.9
D.6
第10题:
阅读下面的程序; Function Func(x As Integer,y As Integer)As Integer Dim n As Integer Do While n < = 4 x=x + y n = n + 1 Loop Func=x End Function Private Sub Command1_Click() Dim x As Integet, y As Integer Dim n As Integer,z As Integer x=1 y=1 For n = 1 To 6 z=Func(x,y) Next n Print z End Sub 程序运行后,单击命令按钮,输出的结果为.
A.16
B.21
C.26
D.31
第11题:
单击命令按钮时,下列程序代码的执行结果为 Private Sub Command1_Click( ) Print MyFunc(24,18) End Sub Public Function MyFunc(m As Integer,n As Integer)As Integer Do While m ◇ n Do While m>n:m=m—n:Loop DO While m<n:n=n-m:Loop Loop My Func=m End Function
A.2
B.4
C.6
D.8
第12题:
代码for i in range(3):print(i,end=’,’)的执行结果为()。
第13题:
以下用户自定义函数 Function Func(a As Integer,b As Integer)As Integer Static m As Integer.i As Integer m=0:i=2 i=i+m+i m=i+a-i-b Func=m End Function 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim k As Integer,m As Integer,p As Integer k=4:m=1 P=Func(k,m) Print P End Sub 程序运行后,单击命令按钮,输出结果为
A.8
B.9
C.10
D.11
第14题:
下列程序输出的结果为【 】。
Private Sub Commandl_Click( )
Dim a As Boolean
a = True
If a Then GoTo 11 Else GoTo 22
11:
Print "VB";
22:
Print "VC"
End Sub
第15题:
第16题:
下列程和序段的执行结果为 x=Int(Rnd()+9) Select Case X Case 10 Print "excellent" Case 9 Print "good" Case 8 Print "pass" Case Else Print "fail" End Select
A.excellent
B.good
C.pass
D.fail
第17题:
已知x代表某个百分制成绩,下列程序段用于显示对应的五级制成绩,正确的是( )
A.If x>=60 Then Print"及格" Else If x>=70 Then Print"中" Else If x>=80 Then Print"良" Else If x>=90 Then Print"优" Else Print"不及格" End If
B.If x<90 Then Print"良" Else If x<80 Then Print"中" Else If x<70 Then Print"及格" Else If x<60 Then Print"不及格" Else Print"优" End If
C.If x>=90 then Print"优" Else If x>=80 Then Print"良" Else If x>=70 Then Print"中" Else If x>=60 Then Print"及格" Else Print"不及格" End If End Select
D.Select Case x Case x>=90 Print"优" Case x>=80 Print"良" Case x>=70 Print"中" Case x>=60 Print"及格" Case Else Print"不及格"
第18题:
阅读下列程序: Dim SW As Boolean Function func(X As Integer)As Integer If X<20 Then Y=X Else Y=20+X End If func=Y End Function Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single, Y As Single) SW=False End Sub Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single, Y As Single) SW=True End Sub Private Sub Command1_Click() Dim intNum As Integer intNum=InputBox(" ") If SW Then Print func(intNum) End If End Sub 程序运行后,单击一次窗体,再单击命令按钮,将显示一个输入对话框,如果在对话框中输入20,则程序的输出结果为
A.0
B.20
C.40
D.无任何输出
第19题:
下列程序段的执行结果为
m=1
n=1
Select Case m
Case 1
Select Case n
Case 0
print "A"
Case 1
Print "B"
End Select
Case 2
Print "C"
End Select
A.A
B.B
C.C
D.0
第20题:
有如下的函数过程: Function Func2(a As Integer, b As Integer)'As Integer Static m As Integer, i As Integer m=0 i=2 a=i+m+1 b=i+a+b Func2=m End Function 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim p As Integer, k As Integer, m As Integer k=4 m=1 p=Fune2(k, m) Print k; m p = Func2(k, m) Print k; m End Sub 程序运行后,单击命令按钮,输出结果为( )。
A.3 6<CR>3 6
B.3 6<CR>3 11
C.3 11<CR>3 6
D.3 11<CR>3 11
第21题:
若有如下的函数过程: Function Func2(a As Integer, b As Integer)As Integer Static m As Integer, i As Integer m=0 i=2 a=i+m+1 b=i+a+b Func2 = m End Function 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim p As Integer, k As Integer, m As Integer k=4 m=1 p = Func2(k, m) Print k; m p = Func2(k, m) Print k; m End Sub 程序运行后,单击命令按钮,输出结果为( )。
A.3 6<CR>3 6
B.3 6<CR>3 11
C.3 11<CR>3 6
D.3 11<CR>3 11
第22题:
下列程序段的执行结果为______。 Private Sub Command1_Click() a=1:b=1 Select Case a Case 1 Select Case b Case 0 Print "你好!" Case 1 Print "Hello!" End Select Case 2 Print"谢谢使用!" End Select End Sub
A.你好!
B.谢谢使用!
C.Hello!
D.你好!谢谢使用!
第23题:
A.10
B.100
C.10100
D.10010
第24题: