举一反三
- 运行下面程序后,正确的输出结果是 ______。Private Sub Command1_ Click() x = 6 if x >6 then Print "x>6": Else if x <8 then Print "x<8"; Else if x = 6 then Print "x=6": End if End if End ifEnd Sub A: x<8 x=6 B: x<8 C: x=6 D: x<8或x=6
- 中国大学MOOC: 在窗体上添加一个命令按钮Command1,然后编写如下事件过程:Private Sub Command1_Click() x = InputBox(Input) Select Case x Case 1, 3 Print 分支 1 Case Is > 4 Print 分支 2 Case Else Print Else 分支 End SelectEnd Sub程序运行后,如果在输入对话框中输入2,则窗体上显示的是( )。
- 在窗体上添加一个命令按钮Command1,然后编写如下事件过程: Private Sub Command1_Click() For i = 1 To 4 x = 4 For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 Next k Next j Next i Print x End Sub 程序运行后,单击命令按钮,显示结果为( )。
- 在窗体中添加一个命令按钮(名为Command1),然后编写如下代码: Public x as integer Private Sub Command1_Click( ) x=5 Call s1 Call s2 MsgBox x End Sub Private Sub s1( ) x=x+10 End Sub Private Sub s2( ) Dim x as integer x=x+10 End Sub 窗体打开运行后,单击命令按钮,则消息框的输出结果是______
- 在窗体上画一个命令按钮Command1,编写事件代码如下: Public x As Integer Private Sub Command1_Click() x=3 Call f1 Call f2 MsgBox x End Sub Private Sub f1() x=x*x End Sub Private Sub f2() Dim x As Integer x=x+4 End Sub 运行窗体后,单击命令按钮,则消息框的输出结果为______。
内容
- 0
设窗体上有一个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
- 1
已知一窗体中有如下函数过程和一命令按钮Command1,则单击Command1时,输出结果为。 Public Function Fn(n) If n = 0 Then Fn = 1 Else Fn = Fn(n - 1) * n End Function Private Sub Command1_Click() Print Fn(6) End Sub
- 2
运行如下程序,输出结果是 。 try: x, y = 1, 0 z = x / y print(0, end=",") except: print("1", end=",") else: print("2", end=",") finally: print("3", end=",")
- 3
在窗体中添加一个命令按钮 Command1 , 并编写如下程序 : Private Sub Command1_Click() x = InputBox(x) If x ^ 2 = 9 Then y = x If x ^ 2 < 9 Then y = 1 / x If x ^ 2 > 9 Then y = x ^ 2 + 1 Print y End Sub 程序运行时,单击命令按钮,在 InputBox 中输入 3 ,然后单击“确定”按钮,程序的运行结果为( )。
- 4
在窗体中添加一个命令按钮(名为Command1),然后编写如下代码: Public x as integer Private Sub Command1_Click( ) a=10 Call s1 Call s2 MsgBox x End Sub Private Sub s1( ) x=x+20 End Sub Private Sub s2( ) Dim x as integer x=x+20 End Sub 窗体打开运行后,单击命令按钮,则消息框的输出结果是______。 A: 10 B: 30 C: 40 D: 50