首页/ 题库 / [单选题]下列程序的运行结果为 Dim a(-1 的答案

下列程序的运行结果为 Dim a(-1 To 6) For i=LBound(a,1)To UBound(a,1) a(i) = i Next i Print a (LBound(a,1));a(UBound(a,1))

单选题
2022-02-21 16:57
A、0 0
B、-5 0
C、-1 6
D、0 6
查看答案

正确答案
C

试题解析
解析:取数值的下界函数LBound()功能是返回数值名指定的数组的指定维数的下界值,取数组的上界函数UBound()的功能是返回数组名指定的数组的指定维度的上界值。因为程序中定义了一个数组a(-1,6),所以上界是6,下界是-1。

标签:
感兴趣题目
下面程序段,运行后的结果是 Private Sub Commandl_Click( ) Dim b%(1 To 4),i%,t# For i=1 To 4 b(i)=i Next i t=Tof(b( ) ) Print"t=";t, End Sub Function Tof(a() As Integer) Dim t#,i% t=1 For i=2 To UBound(A)t=t * a(i) Next i Tof=t End Function
下面程序段,运行后的结果是 Private Sub Command1_Click() Dim b%(1 To 4),i%,t# For i=1 To 4 b(i) =i Next t=Tof(b() ) Print"t=";t, End Sub Function Tof(a() As Integer) Dim t#,i% t=1 For i=2 To UBound(a) t=t*a(i) Next Tof=t End Function
下面程序段,运行后的结果是 Private Sub Command1_Click() Dim b%(1 To 4) ,i%, t# For i = 1 To 4 b(i) =i Next t =Tof(b() ) Print "t ="; t, End Sub Function Tof(a() As Integer) Dim t#, i% t=1 For i =2 To UBound(A)t=t * a(i) Next Tof = t End Function
下列程序段的执行的结果是 Dim a(10),b(10) i=3 For j=1 To 5 a(j) =j b(i) =2 * i + j Next j Print b(i);a(i)
设有如下程序: Private Sub Command1_Click() Dim a Dim I As Integer a=Array(1,2,3,4,5,6,7,8,9) For I=0 To 3 Print a(5-I); Next I End Sub 程序运行后,单击窗体,则在窗体上显示的是()
程序运行后,单击窗体,则在窗体上显示的内容是(). 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
编写以下程序段: DIM I, J, K, A A=0 FOR I = 1 TO 3 FOR J = 1 TO I FOR K=-J TO 3 A=A+1 NEXT K NEXT J NEXT I 执行上面的三重循环后,变量A的值为( )。
有下列程序段,其输出结果为( )。 a=0:b=0 For i=-1 To-2 Step-1 For j=1 To 2 b=b+1 Next j a=a+1 Next i Print a;b
下列程序段的执行结果为______。 A=0: B=0 For I=-1 To -2 Step-1 For J=1 To 2 B=B+1 Next J A=A+1 Next I Print A; B
下列程序段的执行结果为 ______。A=0:B=0For I = -1 To -2 Step -1 For J = 1 To 2 B=B+1 Next J A=A+1Next IPrint A; B
有下列程序段,其输出结果是( )。 a=0:b=0 For i=-1 To -2 Step -1 For j=1 To 2 b=b+1 Next j a=a+1 Next i Print a;b
下列程序段的执行结果为( )。 a=1 b=1 For I=1 To 3 f=a+b a=b b=f Print f: Next I
相关题目
运行下面的程序后,输出的结果为 Cls Dim t(5,5) as Integer For i=1 To 5:t(i,i)=1:Next For i=1 To 5 For j=1 To 5 Print t(i,j), Next j Print Next I
以下程序运行后,消息框的输出结果是( )。 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 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
在窗体上添加如下命令按纽,然后编写如下事件过程: Private Sub Command1_Click() Dim a(10)As Integer Dim 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该过程的运行结果为______。
下面程序:________Option Base 1Private Sub Command1_Click() Dim a(10),p(3)As Integer Dim i,k As Integer k=5 For i=1 To 10 a(i)=i Next For i=1 To 3 p(i)=a(i*i) Next For i=1 To 3 k=k+p(i)*2 Next Print kEnd Sub运行后的输出结果为________。
以下程序的输出结果是( )。 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 to 3 p(i)=a(I*j) Next j For I=1 to 3 k=k+p(I)*2 Next I Print k End Sub
运行下面的程序后,输出的结果为 Cls Dim t(5,5)as Integer For i=1 To 5:t(i,i)=1:Next For i=1 To 5 For j=1 To 5 Print t(i,j), Next Print Next
运行下面的程序后,输出的结果为 Cls Dim t(5, 5) as Integer For i=1 To 5: t(i,i) =1: Next For i = 1 To 5 For j = 1 To 5 Print t(i, j), Next Print Next
下列程序段的执行结果为______。Dim A(10),B(5) For i=1 To 10 A(i)=i Nex i For j=1 To 5 B(j)=j*20 Next j A(5)=B(2) Print "A(5)=";A(5)
以上程序段运行的结果是:______. Dim a(-1 To 5) As Boolean Dim flag As Boolean flag = False Dim i As Integer Dim j As Integer Do Until flag = True For i = -1 To 5 j=j+1 if a(i)= False Then a(i)= True Exit For End If If i = 5 Then flag = True End If Next Loop Print j
以下程序段运行的结果是 ______。 Dim a(-1 To 5)As Boolean Dim flag As Boolean flag=False Dim i As Integer Dim j As Integer Do Until flag=True For i=-1 To 5 j=j+1 If a(i)=False Then a(i)=True Exit For End If If i=5 Then flag=True End If Next Loop Print j
下列程序段的执行结果为 ______。 Dim A(10),B(5) For i=1 To 10 A(i)=i Next i For i=1 To 5 B(j)=j*20 Next i A(5)=B(2) Print=A(5)= ";A(5)
下列程序段的执行结果为______。 Dim A(10),B(5) For i=1 To 10 A(i)=i Next i For j=1 To 5 B(j)=j*20 Next j A(5)=B(2) Print"A(5)="; A(5)
下列程序段的执行结果为 ______。 Dim A(10),B(5) For i=1 To 10 A(i)=i Next i For j=1 To 5 B(j)=j*20 Next j A(5)=B(2) Pring"A(5)=";A(5)
下列程序段的执行结果为______。 DimA(10),B(5) For i=1 To 10 A(i+=i Next i For i=1 To 5 B(j)=j*20 Nextj A(5)=B(2) Pfiat"A(5)";A(5)
下列程序运行时输出的结果是( )。 Option Base 1 Const a=10 Private Sub Form_Click() Dim x(a)As Integer k=-1 For i=1 To a x(i)=i*k k=(-1)*k Next i For i=1 To 10 Print x(i) Next i End Sub
在窗体上画一个名称为Commandl的命令按钮,然后编写如下程序: Private Sub Command1_Click() Dim i As Integer,j As Integer Dim a(10, 10)As Integer For i=1 To 3 For i=1 To 3 a(i,j)=(i-1) *3+j Print a(i,j); Next i Print Next i End Sub 程序运行后,单击命令按钮,窗体上显示的是
下列程序的运行结果为 Dim a(-1 To 6) For i=LBound(a,1)To UBound(a,1) a(i) = i Next i Print a (LBound(a,1));a(UBound(a,1))
若有以下程序,当程序运行后,单击命令按钮,则输出的结果为( )。 Private Sub Command1_Click() Dim a%(1 To 4), b%(3 To 6), i%, s1#, s2# For i= 1 To 4 a(i) = i Next i For i=3 To 6 b(i) = i Next i s1 = Factorial (A) s2 = Factorial (B) Print "s1="; s1; "s2="; s2 End Sub Function Factorial(a() As Integer) Dim t#, i% t=1 For i = LBound(A)To UBound(A) t = t * a(i) Next i Factorial = t End Function
下列程序的输出结果是( )。 Dim a a=Array(1,2,3,4,5,6,7,8) i=0 For k=100 To 90 Step-2 s=a(i)^2 If a(i)>3 Then Exit For i=i+1 Next k Print k;i;s
下面程序运行后,输出结果为( )。 Dim a() a=Array(1,3,5,7,9) s=0 For i=1 To 4 s=s*10+a(i) Next i Print s
广告位招租WX:84302438

免费的网站请分享给朋友吧