刷题首页
题库
高中信息
题干
某VB程序段如下:
Private Sub Command1_Click()
Dim a As Integer
Dim b As Boolean
a = (a + 1) * 2
b = a - 1
print a:print b
End Sub
程序运行时,单击命令按钮Command1后,变量a和b的值分别是()
A.2 1
B.2 true
C.4 -1
D.4 False
上一题
下一题
0.99难度 选择题 更新时间:2019-03-02 02:54:45
答案(点此获取答案解析)
同类题1
在Visual Basic中,下列语句定义错误的是:( )
A.const g="9.8"
B.Dim False As Boolea
C.Dim b(1 to 5) As String
D.Dim y As Long
同类题2
下列VB程序运行时,单击Command1后,标签Label1中显示的内容是_______
Private Sub Command1_Click()
Dim s As Integer, j As Integer
s = 0
For j =" 1" To 10
If j Mod 2 <> 0 Then
s =" s" + j
End If
Next j
Label1.Caption = Str(s)
End Sub
同类题3
在VB语言中,表示“ a>0且b<12”的正确表达式是( )。
A.b<12 or a>0
B.b>12 and a<0
C.a>12 or a<0
D.a>0 and b<12
同类题4
某VB的事件过程如下:
Pirvate Sub Command1_Click()
a = Val(Text1.Text)
b = a * a + 1
Text1.Text = b
End Sub
程序运行时,在文本框Text1中输入2,连续两次单击命令按钮Command1后,Text1中显示的内容是( )
A.677
B.2
C.26
D.5
同类题5
运行如下Visual Basic程序,单击命令按钮Command1,出现如图所示的出错信息。发生“类型不匹配”错误时所执行的语句是( )
Private Sub Command1_Click()
Dim a As String, b As String, c As Integer
a = "Good" '①
b = "bye" '②
c =
__________1__________
'③
Text1.Text =" a" + b + c '④
End Sub
A.①
B.②
C.③
D.④
相关知识点
算法软件操作
VB程序的调试