阅读程序写结果 下载本文

150,则执行下列程序后,TEXT3的值为( )。

Private Sub Command1_Click() Dim m, n As Integer m = Val(Text1.Text) n = Val(Text2.Text) If n * m = 0 Then Exit Sub End If

If m < n Then

t = m: m = n: n = t End If Do

r = m Mod n m = n n = r

Loop While r <> 0 Text3.Text = m End Sub

答案: 50 权重:4 难易度:3

题目 :115、执行下列程序后,变量a的值为( )。

Dim I As Integer Dim a As Integer a = 0

For I = 1 To 100 Step 2 a = a + 1 Next I

答案: 50 权重:3 难易度:1

题目 :116、当变量X=2,Y=5时,以下程序的输出结果为( )。 Do Until y > 5 x = x * y y = y + 1 Loop Print x

答案: 10 权重:2 难易度:1

题目 :117、在窗体上添加一个命令按钮,名为command1,一文本框,名为text1,则执行如下事件过程后,文本框中的输出为( )。 For I = 1 To 4 For j = 1 To 3 x = 3

For k = 1 To 2

x = x + 3 Next k Next j Next I

Text1.Text =str( x)

答案: 9 权重:3 难易度:2

题目 :118、下列命令按纽事件过程执行后,输出结果是( )。 For m = 1 To 1000 Step 2 a = 10

For n = 1 To 20 Step 2 a = a + 2 Next n Next m Print a

答案: 30 权重:3 难易度:2

题目 :119、在一个窗体上添加一命令按纽控件,名为Command1,事件过程如下,则该过程的执行结果为( )。 Option base 1

Private Sub Command1_Click() Dim a(5) As Integer Dim k As Integer

Dim total As Integer a(1) = 2 a(2) = 5 a(3) = 4 a(4) = 10 a(5) = 6

For k = 1 To 5

total = total + a(k) Next k

Print total End Sub

答案: 27 权重:4 难易度:3

题目 :120、在窗体上添加一命令按纽,名为Command1,然后为该命令按纽编写如下事件过程,该过程执行结果为( )。 Option base 1

Private Sub Command2_Click() Dim a As Variant

a = Array(1, 2, 3, 4) j = 1

For I = 4 To 1 Step -1 s = s + a(I) * j

j = j * 10 Next I Print s End Sub

答案: 1234 权重:3 难易度:2

题目 :121、假定有如下Sub过程: Sub s(x As Single, y As Single) t = x

x = t / y y = t Mod y End Sub

在窗体上添加一名为Command1的命令按纽,编写如下事件过程,则该事件过程的执行结果为( )。

Private Sub Command1_Click() Dim a As Single Dim b As Single a = 5 b = 4

Print a, b End Sub

答案: 1.25 1 权重:2 难易度:1

题目 :122、有如下的一个函数过程: Function fn(ByVal num As Long) Dim k As Long k = 1

num = Abs(num) Do While num

k = k * (num Mod 10) num = num \\ 10 Loop

fn = k End Function

以下是一个调用该函数的事件过程,在运行该程序后,在输入对话框输入数字“123”,该过程的运行结果是( )。 Private Sub Command5_Click() Dim n As Long Dim r As Long

n = InputBox(“请输入一个数值”) n = CLng(n) r = fn(n) Print r End Sub

答案: 6 权重:3 难易度:2

题目 :123、下列程序的执行结果是( )。 K = 0

For I = 1 To 3 a = I ^ I ^ k Print a; Next I

答案: 111 权重:3 难易度:1

题目 :124、以下程序段的执行结果是( )。 Dim A(3, 3) For m = 1 To 3 For n = 1 To 3

If n = m Or n = 3 - m + 1 Then A(m, n) = m + n Else

A(m, n) = 0 End If Next n Next m

For m = 1 To 3 For n = 1 To 3 Print A(m, n); Next n Print Next m

答案: 2 0 4

0 4 0

4 0 6 权重:4 难易度:3

题目 :125、有如下函数:

Private Function firstfunc(x As Integer, y As Integer) As Integer Dim n As Integer Do While n <= 4 x = x + y n = n + 1 Loop

firstfunc = x End Function

调用该函数的事件过程如下: Private Sub Command1_Click() Dim x As Integer Dim y As Integer Dim n As Integer Dim z As Integer x = 1

y = 1

For n = 1 To 3

z = firstfunc(x, y) Next n Print z End Sub

该事件过程的执行结果是( )。 答案: 16 权重:3 难易度:1

题目 :126、下列程序执行后,整型变量n的值为( )。 N=0

for I=1 to 100

if I mod 4=0 then n=n+1 next I

答案: 25 权重:3 难易度:1

题目 :127、下列程序执行后,变量S的值为( )。

Dim s As Long, x As Integer s = 0

For x = 1 To 10 Step 2 s = s + x Next x

Text1.Text = s

答案: 25 权重:2 难易度:1

题目 :128、有如下程序段,该程序执行后,变量a的值为( )。 For I = 1 To 2 For J = 1 To 2 For k = 1 To 2 a = a + 2 Next k Next J Next I

Print a

答案: 16 权重:3 难易度:1

题目 :129、在窗体上添加一命令按纽,名为Command1,然后为该命令按纽编写如下事件过程,该过程执行结果为( )。 Option base 1

Private Sub Command2_Click() Dim a As Variant Dim s As integer

a = Array(1, 2, 3, 4)

j = 1

For I = 1 To 4 Step 1 s = s + a(I) * j j = j * 10 Next I Print s End Sub

答案: 4321 权重:4 难易度:2

题目 :130、有如下一个函数过程: Function f(a As Integer) b = 0 Static c b = b + 1 c = c + 1

f = a + b + c End Function

在窗体上添加一个命令按纽,事件过程如下:

Private Sub Command1_Click() Dim a As Integer a = 2

For I = 1 To 3 Print f(a); Next I End Sub

运行该程序,单击命令按纽,输出结果是( )。

答案: 4 5 6 权重:3 难易度:2

题目 :131、在窗体上添加一命令按纽,名为Command1,事件过程如下: option base 1

Private Sub Command2_Click() Dim a(4, 4) As Variant For I = 1 To 4 For j = 1 To 4

a(I, j) = (I - 1) * 3 + j Next j Next I

For I = 3 To 4 For j = 3 To 4 Print a(I, j); Next j Print Next I End Sub

该程序执行后,结果是( )。 答案: 9 10

12 13 Next I 权重:4 难易度:3 题目 :132、下列程序段的执行结果是( )。 N = 10 For k = n To 1 Step -1 x = Sqr(k) x = x - 2 Next k Print x -2 答案: -3 权重:3 难易度:2 题目 :133、下列程序段的执行结果是( )。 X = 1 y = 1 For I = 1 To 3 f = x + y x = y y = f Print f; Next I 答案: 2 3 5 权重:3 难易度:2 题目 :134、下列程序段的执行结果是( )。 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 答案: 2 4 权重:3 难易度:1 题目 :135、下列程序段的执行结果是( )。 Dim s1(5) As Integer Dim s2(5) As Integer Dim s3(5) As Integer n = 4 For I = 1 To n s1(I) = I l = n + 1 - I s2(I) = l

s3(5) = 0 For k = 1 To n s3(k) = s1(k) * s2(k) s3(5) = s3(5) + s3(k) Next k Print s3(5) 答案: 20 权重:4 难易度:3 题目 :136、下列程序段的执行结果是( )。 Dim A(5) For I = 0 To 4 A(I) = I + 1 m = I + 1 If m = 3 Then A(m - 1) = A(I - 2) Else A(m) = A(I) End If If I = 3 Then A(I + 1) = A(m - 4) A(4) = I Print A(I); End If Next I 答案: 4 权重:3 难易度:2 题目 :137、有如下程序段,该程序段执行完毕后,共循环了( )次。 For I = 1 To 2 For J = 1 To I For k = 1 To J Print \ Next k Next J Next I 答案: 4 权重:3 难易度:2 题目 :138、下列程序段运行后,输出结果是( )。 B = 1 Do While b < 7 b = b * (b + 1) Loop Print b 答案: 42 权重:2