题型:单选题 题类:真题 难易度:困难
浙江省普通高等学校招生2021年6月信息技术选考试卷
a(1)=“ABC”:a(2)=“DEF”:a(3)=“GHI”
s1=“31,12,23,33”:s2=“”
For i = 1 To Len(s1)
ch = Mid(s1,i,1)
If ch < > “,” Then
i=i+1
p=Val(Mid(s1,i,1))
s2=s2+Mid(a(p),Val(ch),1)
End If
Next i
执行该程序段后,变量s2的值是( )
依据上述描述设计如下VB程序:
Dim xh(1 To 100) As Integer , xm(1 To 100) As String, cj(1 To 100) As Integer Dim n As Integer, m As Integer
Private Sub Form_Load()
'本过程从数据库依次读取n位同学的序号、姓名及成绩,然后按成绩降序排序,将学生序号、姓名成绩存储在数组xh、xm、cj中,结果显示在List1中,
End Sub
'显示每位同学的位置 Private Sub Command1_Click() Dim wz As String m=Val(Text1.Text) For i = 1 To n \ m For j = 1 To m If ① Then wz = wz + xm((i - 1) * m + j) + " " Else wz=xm((i-1) * m + j)+" "+wz End If Next j List2.AddItem wz wz =" " Next i If n Mod m <> 0 Then For i= wz = wz + xm(i) + " " Next i List2.AddItem wz End If End Sub |
'显示每位同学的位置编号 Private Sub Command2_Click() Dim zu As Integer Dim ha As String, hb As String List3.AddItem "序号" & vbTab & "姓名" & vbTab & "位置" 'vbTab 用于字符对齐 For i = 1 To n zu = ② ha = Trim(str(zu)) If Len(ha) = 1 Then ha = "0" + ha If zu Mod 2 = 0 And zu <= n \ m Then hb = ③ Else hb = Str(i - m * (zu - 1)) End If hb = Trim(str(hb)) 'Trim 函数功能是去除字符空格 If Len(hb) = 1 Then hb = "0" + hb List3.AddItem str(i) & vbTab & xm(i) & vbTab+ ha + hb Next i End Sub |
请回答下列问题:
Dim s1 As String, s2 As String Dim c As Integer, i As Integer s1 = InputBox("请输入一串字符") s2 = "" c = Len(s1) For i = ▲ s2 = Mid(s1, i, 1) + s2 Next i Print s2 | 【函数功能提示】 ⑴函数Len(x)的功能是:取字符串x的长度值(即字符个数值)。 若x="abc",则Len(x)的值为3。 ⑵函数Mid(x,y,z)的功能是:在字符串x中第y个字符开始取z个字符。 若x="abcdefg",则 Mid(x,4,3)取得的值是"def"。 |
程序空白处应填写的语句是:{#blank#}1{#/blank#}。
试题篮