试题 试卷
题型:单选题 题类:常考题 难易度:普通
教科版2017-2018学年高中信息技术学业水平考试试题汇总2
Private Sub Command1_Click()
Dim sjzs As Integer
Dim rjzs As String
sjzs = Val(Text1.Text)
rjzs = ""
Do While Int(sjzs / 2) > 0
rjzs = Str(sjzs Mod 2) + rjzs
sjzs = Int(sjzs / 2)
Loop
Label1.Caption = rjzs
End Sub
实现该功能的VB程序段如下:
Function space(x As Integer)As String ‘输出格式化,设置左侧的空格数量
Dim n As Integer
For n=9 To x Step-1
①
Next n
End Function
Private Sub Form_Load()
Dim t As Long,i As Integer,n As String
Dim a(1 To 9)As String
Dim b(1 To 9)As String
Const num=“987654321”
For i=1 To 9
t=t*10+i
a(i)=space(i)+CStr(t) ‘CStr函数的功能是将数值转为字符,转换时不会添加空格
②
n=n+a(i)+“*8+”+CStr(i)+“=”+b(i)+Chr(13) ‘Chr(13)实现换行处理
Next i
Label1.Caption=n
For i=1 To 3
k=“”
Fori-1 To 2*i-1
k=k+“*”
Next j
List1.AddItem k
该程序运行后,在列表框List1中显示的是( )
f=[‘A’,‘B’,‘C’]
a=len(f)
print(‘a=’,a)
试题篮