下列程序段的执行结果为a=1b=0Select Case a Case 1 Select Case b Case 0 Print"**0**" Case 1 Print"**1**" End SelectCase 2 Print"**2**"End Select A.* * 0 * * B.* * 1 * * C.* * 2 * * D.0
举一反三
- 设有下面的语句:Print IIf(x>0, 1, IIf(x<0,-1, 0))与此语句输出结果不同的程序段是______。 A: If x>0 Then x=1 ElseIf x<0 Then x=-1 End If Print x B: If x>0 Then Print 1 ElseIf x<0 Then Print-1 Else Print 0 End If C: Select Case x Case Is>0 Print 1 Case Is<0 Print-1 Case Else Print 0 End Select D: If x<>0 Then If x>0 Then Print 1 ElseIf x<0 Then Print-1 Else Print 0 End If
- 编写如下程序: 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
- 假定x的值为5,则在执行以下语句时,其输出结果为"Result"的正确表示Select Case语句是( ) A: Select Case x Case 1 To 10 Print "Result" End Select B: Select Case x Case Is>5,Is<5 Print "Result" End Select C: Select Case x Case Is>5,1,3 To 4 Print "Result" End Select D: Select Case x Case 1,3,Is>5 Print "Result" End Select
- 假设X的值是5,则执行以下语句时,可得到的输出结果是ABCDEF的Select Case语句是 ( ) A: Select Case X Case 10 To 1 Print“ABCDEF” End Select B: Select Case X Case Is>15,Is<5 Print"ABCDEF" End Select C: Selecl Case K Case Is>5,1,3,To 10 Print"ABCDEF" End Select D: Select Case X Case 1,3,Is>5 Print"ABCDEF" End Select
- 中国大学MOOC: 有如下程序:Private Sub Command1_Click() xcase = 1 t = InputBox("请输入一个数:") Select Case t Case Is > 0 y = xcase + 1 Case Is = 0 y = xcase + 2 Case Else y = xcase + 3 End Select Print xcase; yEnd Sub程序运行时,在对话框中输入-1,则显示的结果为( )。