更多"以下程序的输出结果是( )。 Option Base 1 "的相关试题:
[单项选择]以下程序的输出结果是( )。
Option Base 1
Private Sub Command1_Click( )
Dim a(10),p(3) as Integer
k=5
For I-1 to 10
a(i)=I
Next I
For j=1 to3
p(i)=a(I*j)
Next j
For I=l to 3
k=k+ p (I)*2
Next I
Print k
End Sub
A. 33
B. 28
C. 35
D. 37
[单项选择]以下程序的输出结果是D) 9 12 Option Base 1 Private Sub Command1_Click( ) Dim s(10),p(3)As Integer k=5 For i=1 To 10 a(i)=i Next i For i=1 To 3 p(i)=a(i*i) Next I For i=1 To 3 k=k+ p(i)*2 Next i Print k End sub
A. 33
B. 28
C. 35
D. 37
[单项选择]下列程序运行时输出的结果是
Option Base 1
Private Sub Form_Click( )
Dim x (10)As Integer,y(5)As Integer
For i=1 to 10
x(i)=10-i+1
Next
For i=1 to 5
y(i)=x(2*i-1)+x(2*i)
Next
For i=1 to 5
Print y(i)
Next
End Sub
A. 3 7 11 45 19
B. 19 15 11 7 3
C. 1 3 5 7 9
D. 不确定的值
[单项选择]下列程序运行时输出的结果是( )。 Option Base 1 Private Sub Form_Click( ) Dimx(10)As Integer,y(5) As Integer ForI=1 to 10 x(i)=10-I+1 NextI ForI=1 to 5 y(i)cx(2*-1)+x(2*I) NextI ForI=1 to 5 Printy(i); NextI End Sub
A. 3 7 11 45 19
B. 17 13 9 5 1
C. 1 3 5 7 9
D. 不确定的值
[单项选择]下列程序在运行时输出的结果是()。Option Base 1Private Sub Form_Click( ) Dim x(10) For i=1 To 10x(i)=10-i+1Next i For i=10 To 1 Step-2Print x(i)Next i End Sub
A. 1 3 5 7 9
B. 9 7 5 3 1
C. 1 2 3 4 5 6 7 8 9 10
D. 10 9 8 7 6 5 4 3 2 1
[填空题]执行下面的程序,消息框的输出结果是 【15】 。
Option Base1
Private Sub Command1_Click( )
Dim a(10),P(3)As Integer
k=5
For i=1 To 10
a(i)=i
Next i
For i=1 To 3
P(i)=a(i*i)
Next i
For i=1 To 3
k=k+p(i)*2
Next i
MsgBox k
End sub
[填空题]设有以下程序:
Option Base 1
Private Sub Command1_Click( )
Dim arr1 ,Max as Integer
art1 = Array(12,435,76,24,78,54,866,43)
【14】 = arr1(1)
For i = 1 To 8
If arrl(i)>Max Then 【15】
Next i
Print "最大值:"; Max
End Sub
以上程序的功能是:用Array函数建立一个含有8个元素的数组,然后查找并输出该数组中元素的最大值。
[填空题]下面程序段的运行结果是 【14】 。
Option Base 1
Private Sub swap(a( )As InteSer)
For I=1 to 10/2
t=a(i)
a(i)=a(10-1+1)
a(10-1+1)=t
Next1
End Sub
Private Sub Form_Click( )
Dim x(10)As Integer
For I=1 to 10
x(i)=I*2
Next1
Swap x( )
For1=1 to 10
Print x (i)
Next I
End Sub
[单项选择]设有如下程序
Option Base 1
Private Sub Command1_Click( )
Dim a(10)As Integer
Dim n As Integer
n=lnput Box(“输入数据”)
If n<10 Then
Call GetArray(a,n)
End If
End Sub
Private Sub GetArray(b( )As Integer,n As Integer)
Dim c(10)AsInteger
j=0
For i=1 To n
b(i)=CInt(Rnd( )*100)
If b(i)/2=b(i)/2 Then
j=j+1
c(j)=b(i)
End lf
Next
Print j
End Sub
以下叙述中错误的是
A. 数组b中的偶数被保存在数组c中
B. 程序运行结束时,在窗体上显示的是c数组中元素的个数
C. GetArray过程的参数n是按值传送的
D. 如果输入的数据大于10,则窗体上不显示任何信息
[填空题]下面程序段的运行结果是______。
Option Base 1
Private Sub swap(a( ) As Integer)
For I = 1 to 10/2
t =a(I)
a(I) = a(10-I+l)
a(10-I+1) = t
Next I
End Sub
Private Sub Form Click( )
Dim x(10) As Integer
For I = 1 to 10
x(I) = I * 2
Next I
Swap x( )
For I=1 to 10
Print x(I)
Next I
End Sub
[填空题]阅读程序;
Option Base 1
Private Sub Form_ KeyPress (KeyAscii As Integer)
art = Array(268, 542, 693, 365, 489, 147, 852)
a1 = arr(1)
a2 = 1
If KeyAscii = 13 Then
For a = 2 To 6
If arr(i) > a1 Then
a1 = arr(i)
a2 = i
End If
Next i
End If
Print a1; a2
End Sub
程序运行后,按回车键;输出结果是______。
[填空题]阅读下列程序。
Option Base 1
Private Sub Form Click( )
Dim x(3,3)
For j=l to 3
For k=l to 3
If j=k then x(j,k)=l
If j<>k then x(j,k)=k
Next k
Next j
Call fun(x( ))
End Sub
Private Sub fun(x( ) )
For j=1 to 3
For k=1 to 3
Print x(j,k);
Next k
Next j
End Sub
运行程序时,输出结果为 【14】
[单项选择]设有如下程序:
Option Base 1
Private Sub Command1_Click( )
Dim a(10) As Integer
Dim n As Integer
n=InputBox(“输入数据”)
If n<10 Then
Call GetArray(a,n)
End If
End Sub
Private Sub GetArray(b( )As Integer,n As Integer)
Dim c(10) As Integer
j=0
For i=1 To n
bb(i)=CInt(Rnd( )*100)
If b(i)/2=b(i)/2 Then
j=j+1
c(j)=b(i)
End If
Next
Print j
End Sub
以下叙述中错误的是( )。
A. 数组b的偶数被保存在数组c中
B. 程序运行结束时,在窗体上显示的是c数组中元素的个数
C. GetArray过程的参数n是按值传送的
D. 如果输入的数据大于10,则窗体上不显示任何信息
[填空题]阅读下列程序。
Option Base 1
Private Sub Form Click( )
Dim x(3,3)
For j=l to 3
For k=l to 3
If j=k then x(j,k)=l
If j<>k then x(j,k)=k
Next k
Next j
Call fun(x( ))
End Sub
Private Sub fun(x( ) )
For j=1 to 3
For k=1 to 3
Print x(j,k);
Next k
Next j
End Sub
运行程序时,输出结果为 【14】
[单项选择]阅读程序: Option Base 1 Private Sub Form_Click( ) Dim arr Sum Sum=0 arr=Array(1,3,5,7,9,11,13,15,17,19) For i=1 TO 10 If arr(i)/3=arr(i)/3 Then Sum=Sum+art(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为
A. 13
B. 14
C. 27
D. 15
[单项选择]阅读程序:
Option Base 1
Private Sub Form_Click( )
Dim arr,Sum
Sum=0
arr=Array(1,3,5,7,9,11,13,15,17,19)
For i=1 To 10
If arr(i)/3=arr(i)/3 Then
Sum=Sum+arr(i)
End If
Next i
Print Sum
End Sub
程序运行后,单击窗体,输出结果为( )。
A. 13
B. 14
C. 27
D. 15