单选题
VB
题号 #2273181
在窗体上有一个命令按钮,然后编写如下事件过程:
Private Sub Command1Click( )
Dim a(5)As String
For i=1,To 5
a(i)=Chr(Asc("A")+(i-1))
Next i
For Each b In a
Print b;
Next
End Sub
程序运行后,单击命令按钮,输出结果是( )。
参考答案
A
答案解析
A。【解析】Asc(字符)将字符转换为其ASCII码值,Chr(数字)将数字转换为ASCII相对应的字符。本程序首先定义一维字符串数组a(5),然后将字符“A”的ASCII码值分别加上0、1、2、3、4,转换为字符串存入a(5)。其值为ABCDE。
你可能感兴趣的试题
A.Private Sub save Click( )
Text1.Text=file.save.Caption
End Sub
Text1.Text=file.save.Caption
End Sub
B.Private Sub save Click( )
Text1.Text=save.Caption
End Sub
Text1.Text=save.Caption
End Sub
C.Private Sub file Click( )
Text1.Text=file.save.Caption
End Sub
Text1.Text=file.save.Caption
End Sub
D.Private Sub file Click( )
Text1.Text=save.Caption
End Sub
Text1.Text=save.Caption
End Sub
A.Open"C:\Test2.dat"For Output As#1
Put#1,1,p
Close#1
Put#1,1,p
Close#1
B.0pen"c:\Test2.dat"For Random As#1
Get#1,1,P
Close#1
Get#1,1,P
Close#1
C.Open”C:\Test2.dat”For Random As#1 Len—Len(p)
Put#1,1,P
Close#1
Put#1,1,P
Close#1
D.Open"C:\Test2.dat"For Random As#1 Len=Len(p)
Get#1,1,P
Close#1
Get#1,1,P
Close#1

