![]() |
|
(21) 下列程序段的执行结果为
m=1
n=1
Select Case m
Case 1
Select Case n
Case 0
Print "**0**"
Case 1
Print "**1**"
End Select
Case 2
Print "**2**"
End Select
A.**0**
B.**1**
C.**2**
D.0
正确答案: B
(22) 下列程序段的执行结果为
m=2
n=3
Do
m=m + n
n=n + 1
Loop While m < 10
Print m; n
A.1 5
B.14 6
C.a b
D.10 25
正确答案: B
(23) 有如下的程序段,该程序段执行完后,共执行的循环次数是
total=0
Counter=1
Do
Print Counter
total=total * Counter+1
Print total
Counter=Counter + 1
If total > 10 Then
Exit Do
End If
Loop While Counter <=10
A.4
B.10
C.15
D.20
正确答案: A
(24) 下列程序的运行结果为
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) )
A.0 0
B.-5 0
C.-1 6
D.0 6
正确答案: C
(25) 下面的数组声明中,正确的是
A.Dim pict[3,4] As Integer
B.Dim pict(3,4) As Integer
C.Dim pict[3.4] As Integer
D.Dim pict(3:4) As Integer.
正确答案: B
(26) 下面的过程定义语句中不合法的是
A.Sub Para(ByVal n() )
B.Sub Para(n) As Integer
C.Function Para(ByVal n)
D.Function Para(proc1)
正确答案: B
(27) 单击命令按钮时,下列的执行结果为
Private Sub Command1_Click()
Dim x As Integer, y As Integer
x=86: y=29
Call Proc(x, y)
Print x; y
End Sub
Public Sub Proc(n As Integer, ByVal m As Integer)
n=n Mod 10
m=m Mod 10
End Sub
A.12 32
B.6 29
C.2 3
D.12 3
正确答案: B
(28) 下列程序的执行结果为
Private Sub Command1_Click()
Dim FirStr As String
FirStr= "abcdef"
Print Pct (FirStr)
End Sub
Private Function Pct(xStr As String) As String
Dim tempStr As String, strLen As Integer
tempStr= ""
strLen=Len(xStr)
i=1
Do While i <=Len(xStr) - 3
tempStr=tempStr + Mid(xStr, i, 1) + Mid(xStr, strLen - i + 1, 1)
i=i + 1
Loop
Pct=tempStr
End Function
A.abcdef
B.afbecd
C.fedcba
D.defabc
正确答案: B
(29) 单击命令按钮时,下列程序代码的运行结果为
Private Sub Command1_Click()
Print MyFunc(20, 18)
End Sub
Public Function MyFunc(m As Integer, n As Integer) As Integer
Do While m <> n
Do While m > n: m=m - n: Loop
Do While m < n: n=n - m: Loop
Loop
MyFunc=m
End Function
A.0
B.2
C.4
D.6
正确答案: B