举一反三
- 设有下面程序: Function F( a As Integer) b = 0 Static c b= b + 1 c= c + 2 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 运行上面的程序,单击命令按钮 Command1 ,输出结果为________
- 在窗体上画一个命令按钮,然后编写如下程序: Private Sub Comrnand3_Click( ) Cop 2 Cop 3 Cop 4 End Sub Sub Cop (a As Integer) Static x As Integer x=x + a Print x; End Sub 程序运行后,单击命令按钮,输出结果为 A: 2 3 4 B: 2 5 9 C: 3 5 4 D: 2 4 3
- 有如下函数过程: Function secproc(x As Integer, y As Integer, z As Integer) secproc = 3 * y + z + 2 * x End Function Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a = 2: b = 3: c = 4 Print secproc(c, b, a) End Sub 该程序的运行结果是( )。
- 在窗体上画一个命令按钮<其名称为Command1),然后编写如下事件过程: Private Sub Command1 Click() For i=1 T04 If i=1 Thenx=i If i<=4 Then x=x+1 Print x Next i End Sub 程序运行后,单击命令按钮;其输出结果为 ______。 A: A) 1 2 3 4 B: B) 2 3 4 5 C: C) 2 3 4 4 D: D) 3 4 5 6
- 编写如下程序: Private Sub Command1_Click() Dim score As Integer score = 90 If score > 80 Then r = 5 ElseIf score > 60 Then r = 3 Else r = 1 End If Print r End Sub 程序运行后,单击命令按钮Command1,输出结果为(______)。
内容
- 0
下列程序的运行结果为( )。Private Sub Command1_Click() Dim a(5) As String Dim i As Integer For i = 0 To 5 a(i) = i + 1 Print a(i); Next iEnd Sub A: 123456 B: 6 C: 1 2 3 4 5 6 D: 0
- 1
设窗体上有一个Command1命令按钮,还有以下程序代码: Private Sub Command1_Click() Static x As Integer x=x+1 Call proc(x) Print x, End Sub Private Sub proc(a As Integer) Static x As Integer x=x+a:a=x End Sub 程序运行后,3次单击命令按钮,则产生的输出是 A: 1 2 3 B: 1 3 5 C: 1 3 7 D: 2 4 6
- 2
编写如下程序: Private Sub Command1_Click() Dim n As Integer : Static s As Integer For n = 1 To 3 s = s + n Next Print s End Sub 程序运行后,第三次单击命令按钮Command1时,输出结果为
- 3
编写如下程序: Private Sub Command1_Click; Dim m As Integer, n As Integer m = 2 : n = 1 Select Case m Case 1 Select Case n Case 1 Print "AAA" Case 2 Print "BBB" End Select Case 2 Print "CCC" End Select End Sub 程序运行后,单击命令按钮Command1,输出结果为 A: BBB B: CCC C: AAA D: 1
- 4
编写如下程序: Private Sub Command1_Click() Dim x As Integer, y As Integer x = 1: y = 1 Do y = x * y If y > 10 Then Print x, y Exit Do Else x = x + 3 End If Loop While x <= 10 End Sub 运行程序,输出结果为______