1、一、单选题1、有如下程序段:Dim s%, i%s = 0For i = 10 To 50 Step 10 s = s + i If i = 30 Then Exit For End IfNext iMsgBox( s & & i)执行该段程序后,消息对话框显示的内容为( )。A.60 50B.150 50C.150 30D.60 30答案:D2、下列程序段能且只能显示1!、2!、3!、4!的值的是( )。A.For i = 1 To 4n= 1For j = 1 To in = n * jNext jMsgBox(n)Next iB.n = 1j = 1Do While j = 4n = n
2、 * jj = j + 1LoopMsgBox(n)C.For i = 1 To 4For j = 1 To in = 1n = n * jNext jMsgBox(n)Next iD.n = 1For i = 1 To 4For j = 1 To 4n = n * jMsgBox(n)Next jNext i答案:A3、有如下程序段: Dim i%, j%, n%, m%, k% m = 0 : k = 0 For i = 1 To 5 k = k + 1 n = 0 For j = 1 To 2 n = n + 1 m = m + 1 Next j Next i MsgBox(k & & n & & m)运行该程序代码段后,消息对话框中显示的内容为( )。A.5 10 2B.5 2 2C.5 10 10D.5 2 10答案:D4、下列程序段显示( )个“*”。Dim i%, j%For i = 1 To 5 For j = 2 To i MsgBox(*) Next jNext iA.10B.12C.11D.20答案:A5、对于下面的程序,其循环执行的次数为:_。For i = 1 To 3 For j = 5 To 1 Step -1 Label1.Text = i + j Next jNext iA.14B.12C.13D.15答案:D