更多"运行下列程序,单击Command1命令按钮后,则在窗体上显示第一行和第"的相关试题:
[填空题]运行下列程序,单击Command1命令按钮后,则在窗体上显示第一行和第二行的结果分别是 (14) 和 (15) 。
Private Sub Command1_Click( )
t = 1: x = 2: y = 3: z = 4
If t > 0 Or t = x And x <> y Or y > z Then
t = fun1(t, z)
Print t
Else
t = fun1(x, y)
Print t
End If
Print x
Print y
End Sub
Function fun1(ByVal x As Integer, ByVal y As Integer)As Integer
Do While y <> 0
t = x / y
x = y
y = t
Loop
fun1 = x
End Function
[填空题]运行下列程序,单击Command1命令按钮,则在窗体上显示第一行和第二行的结果分别是 (11) 和 (12)
Private Sub Command1_Click( )
t=1
x=2
y=3
z=4
If t>0 Or t-x And x<>y Or y<>z Then
t=fun1(t,z)
Print t
Else
t=fun1(t,y)
Print t
End If
Print x
Print y
End Sub
Function fun1(ByVal x As Integer, ByVal y As Integer) As Integer
Do While y<>0
t=x/y
x=y
y=t
Loop
fun1=x
End Function
[填空题]运行下列程序,单击Command1,在窗体上显示的第一行内容是(),第二行的内容是(),第三行的内容是()("A"的ASCII码是65,"z"是90) Option Explicit Private Sub Commandl_Click( ) Dim i As Integer,st As String,n As Integer,p As String*1 P="B" For i=3 To 1 Step -1 n=Asc(p)-i If n<65 Then n=n+26 st=Chr(n) st=st & F(i) Print st Next i EndSub Private Function F(n As Integer) Dim i As Integer Static S As Integer For i=1 To n s=s+i Nexti F=S End Function
[填空题]
运行下面的程序,单击Cmd1,窗体上显示的第一行是(),第二行是() ,最后一行是()。
Option Explicit
Private Sub Cmd1_Click( )
Dim A As Integer
A=3
Call Sub1(A)
Print A
End Sub
Private Sub Sub1(X As Integer)
X=X*2+1
If X<10 Then
Call Sub1(X)
End If
X=X*2+1
Print X
End Sub
[填空题]
执行下面的程序,单击command1,窗体上显示的第一行是(),第二行是(),第四行是(),最后一行是()
Option Explicit
Private Sub Command1_Click( )
Dim n As Integer
n=5
Call test(n)
Print n
End Sub
Private Sub test(ByVal n As Integer)
Dim i As Integer,S As String
If n>0 Then
For i=l To n
S=S & CStr(i)
Next i
Print S
Call test(n-2)
Else
Print "0VER"
EndIf
EndSub
[填空题]
执行下面程序,单击命令按钮Cmd1后,窗体上显示的第一行内容是(),第二行内容是(),第三行内容是()。
Option Explicit
Private Sub Cmd1_Click( )
Dim st As String,ch As String*1,t As Integer
Dim i As Integer
st="2,3,8,12,32,65#"
For i=1 To Len(st)
ch=Mid(st,i,1)
If ch<>"," And ch<>"#" Then
t=t*10+Val(ch)
Else
If pd(t) Then Print t
t=0
End If
Next i
End Sub
Private Function pd(ByVal n As Integer)As Boolean
Do While n<>1
If n Mod 2<>0 Then
Exit Function
EndIf
n=n/2
Loop
pd=True
End Function
[填空题]
执行下面程序,单击命令按钮Command1,窗体上显示的第一行内容是(),第二行内容是(),第三行内容是().
Option Explicit
Private Sub Command1_Click( )
Dim a As Integer, b As Integer, i As Integer
a = 1
b = 5
For i = b To a Step -1
a = a + i
b = b + a
If b > 30 Then Exit For
Print a, b
Next i
Print a, b
End Sub
[单项选择]单击一次命令按钮后,下列程序的执行结果为
Private Sub Command1_Click( )
Dim m As Integer,I As Integer,x(10) As Integer
For I=0 To 4:x(I)=I+1:Next I
For I=1 TO 2:Call Prioc(x):Next I
For I=0 TO 3:Print x(I);:Next I
End Sub
Private Sub Prioc(a( )As Integer)
Static I As Integer
Do
a(I)=a(I)+a(I+1)
I=I+1
Loop While I<2
End Sub
A. 3 4 7 5
B. 3 5 7 4
C. 1 2 3 4
D. 1 2 3 5
[单项选择]单击一次命令按钮后,下列程序的执行结果为( )。
Private Sub Command1_Click( )
Dim m As Integer,I As Integer,x(10) As Integer
For I=0 To 4:x(I)=I+1:Next I
For I=1 TO 2:Call Prioc(x):Next I
For I=0 TO 3:Print x(I);:Next I
End Sub
Private Sub Prioc(a( )As Integer)
Static I As Integer
Do
a(I)=a(I)+a(I+1)
I=I+1
Loop While I<2
End Sub
A. private
B. 无修饰符
C. public
D. protected
[单项选择]单击—次命令按钮后,下列程序的执行结果是
Private Sub Command1_Click( )
S=P(1)+P(2)+P(3)+P(4)
Print S
End Sub
Public Function P(N As Integer)
Static Sum
For i=1 To N
Sum=Sum+i
Next i
P=Sum
End Function
A. 15
B. 25
C. 35
D. 45
[填空题]
执行下面程序,单击按钮CmdRun,窗体上显示的第一行结果是(),UBound(a)的值为(),其中a(1)的值为().
Option Explicit
Private Sub CmdRun_Click( )
Dim St As String,i As Integer
Dim a( ) As String,j As Integer,k As Integer
St="abcd"
Call Sub1(St)
Print St
For i=1 To Len(St)
For j=i+1 To Len(St)
If Mid(St,i,1)=Mid(St,j,1) Then Exit For
Next j
If j>Len(St) Then
k=k+1
ReDim Preserve a(k)
a(k)=Mid(St,i,1)
Print "a(";k;")=";a(k)
End If
Next i
End Sub
Private Sub Sub1(S As String)
Dim i As Integer
For i=1 To Len(S)/2
Mid(S,i,1)=Mid(S,Len(S)-i+1,1)
Next i
End Sub
[单项选择]下面程序运行时,单击窗体后,窗体上显示的结果是( )。
Private Sub Form_Click( )
Dim I As Integer
Dim sum As Long
sum=0
For I=10 To 16
If I Mod 3=0 OrI Mod 5=0 Then
sum=sum+I
End If
Next I
Print sum
End Sub
A. 10
B. 12
C. 37
D. 22
[单项选择]下面的程序运行时,单击窗体后,窗体上显示的结果是( )。
Private Sub Form_Click( )
Dim a(1 To 6)As Integer
Dim min1%,i%,j%,n%,t%,k%
a(1)=8:a(2)=6:a(3)=9:a(4)=3:a(5)=2:a(6)=7
n=6
For i=1 To n-1
min 1=i
For j=i+1 To n
If a(j)<a(min1)Then min1=j
Next j
t=a(i):a(i)=a(min1):a(min1)=t
Next i
For i=1 To n
Print a(i)
Next i
End Sub
A. 9 8 7 6 3 2
B. 2 3 6 7 8 9
C. 9 8 7 6 3
D. 2 3 6 7 8
[单项选择]单击一次命令按钮后,下列程序的执行结果是() Private Sub Command1_Click( ) s=P(1) + P(2) + P(3) + P(4) Print s End Sub Public Function P(N As Integer)Static Sum For i=1 To N Sum=Sum + i Next iP=Sum End Function
A. 15
B. 25
C. 35
D. 45