⑴ 将字符的 ASCII 码值以字节为单位进行加密处理;
⑵ 将一个字节的8位二进制数右移1位,最高位用右移出来的最低位补充;
⑶ 将二进制数转换为十六进数,顺序连接,即为该字符的密文。
用 UltraEdit 软件观察字符“2018,Lucky!”的内码如图所示。
则字符“z”(小写英文字母)加密后的密文是:( )
下列说法不正确的是( )
Dim a(1 To 10) As Integer
Dim s As String, n, i As Integer
s = "54851845236": n = Len(s)
For i = 1 To n - 1
a(i) = Val(Mid(s, i, 2))
Next i
For i = 1 To n - 2
k = i
For j = i + 1 To n - 1
If a(k) < a(j) Then k = j
Next
If k <> i Then
t = a(k): a(k) = a(i): a(i) = t
End If
Next i
Text1.Text = Str(a(1))
该程序段运行后,文本框 Text1 中显示的内容是:( )
Dim a(1 To 10) As Integer
Dim s As String, n, key As Integer
a(1) = 23: a(2) = 33: a(3) = 44: a(4) = 55: a(5) = 66: a(6) = 77
i = 1: j = 6: c = 0: key = 35
Do While i <= j
c = c + 1
m = (i + j) \ 2
If (j - i + 1) Mod 2 = 0 Then m = m + 1
If a(m) = key Then Exit Do
If key < a(m) Then j = m - 1 Else i = m + 1
Loop
该程序段运行后,下列各变量的值不正确的是( )
图2
Private Sub Command1_Click
Dim s As String, ch As String, sum As Integer
Dim fh As Integer
s = Text1.Text: fh = 1: p = 0: sum=0
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "0" And ch <= "9" Then
p =
Else
sum =
p = 0
If ch = "-" Then
fh = -1
ElseIf ch = "+" Then
fh = 1
End If
End If
Next i
Label1.Caption = Str(sum)
End Sub
请回答以下问题。结合制作脚本及图2,请回答案问题⑵⑶⑷⑸⑹
场景名:main |
序号类别:2 |
进入方式:由“load”场景单击“Enter”按钮进入 |
呈现方式: ⒈足球从舞台外右上侧进入舞台, 最终停在舞台下方中央。 ⒉“按钮”图层的按钮出现在舞台 左下方,单击该按钮,动画从本 场景第1帧开始播放。 |
呈现顺序: ⒈一开始出现草地背景,“音乐”响起。 ⒉动画开始 1 秒后,足球从场外右上侧飞入,补间动画持续2秒后,静止在舞台下方中央。 ⒊动画开始1.5秒后,文字由小变大,旋转一圈进入舞台上方,持续2秒后静止在舞台上。 ⒋最后出现“ replay”按钮,动画停止播放。 |
图1
图2
Private Sub Command1_Click
Dim x, y As Integer
Dim n As Integer
Dim s As String
x = Val(Text1.Text): y = Val(Text2.Text)
n = Val(Text3.Text)
s = s + Str(x \ y)
s = s + "."
k = x Mod y
For i = 1 To n
‘①
‘②
k = x Mod y
Next i
Label1.Caption = "商为: " + s
End Sub
① ②
下标 |
1 |
2 |
3 |
4 |
5 |
值 |
5 |
3 |
3 |
2 |
4 |
第一步:统计数组 a 中每个值 a(i)出现的次数,存入 b(a(i)),统计完成后数组 b 的情况如下:
下标 |
1 |
2 |
3 |
4 |
5 |
值 |
0 |
1 |
2 |
1 |
1 |
第二步:从前向后,依次使数组 b 中的每个值等于其与前一项之和,这样数组 b(a(i))就代表了数组 a 中小于或等于 a(i)的元素个数,完成第二步后数组 b 如下:
下标 |
1 |
2 |
3 |
4 |
5 |
值 |
0 |
1 |
3 |
4 |
5 |
第三步:从后往前,依次将数组a中元素填入数组c中,将数组元素a(i)放在数组c的第b(a(i))项,如元素a(1)=5,应该放在数组c的b(5)位(即c(5))。每放一个元素就将b(a(i))递减;完成第三步后,数组c如下所示,已经完成升序排序,且相对位置不变,即原来a(2)的值3仍然在a(3)的值3前面。
下标 |
1 |
2 |
3 |
4 |
5 |
值 |
2 |
3 |
3 |
4 |
5 |
程序运行界面如右图所示:
实现上述功能的VB程序如下,回答以下问题:
Dim a(1 To 50) As Integer '存放学生的成绩
Dim sname(1 To 50) As String '存放学生姓名
Dim n As Integer
Private Sub Command1_Click
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
conn.ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
App.Path + "\stu.accdb"
conn.Open
strSQL = "SELECT * From stucj"
Set rs.ActiveConnection = conn
rs.Open strSQL
n = 0
List1.AddItem "姓 名" & " " & "成绩"
Do While Not rs.EOF
n = n + 1
a(n) = rs.Fields("cj")
sname(n) = rs.Fields("xm")
List1.AddItem sname(n) & " " & Str(a(n))
Loop
rs.Close
conn.Close
End Sub
Private Sub Command2_Click
Dim i As Integer, k As Integer
Dim b(0 To 100) As Integer
Dim c(1 To 50) As Integer, c1(1 To 50) As String 'c 和 c1 作为临时数组
For i = 1 To n
b(a(i)) = b(a(i)) + 1
Next
For i = 1 To 100
b(i) =
Next
For i = n To 1 Step -1
c(b(a(i))) = a(i)
c1(b(a(i))) = sname(i)
Next
For i = 1 To n '把临时数组 c 和 c1 中的数据放入 a 和 sname 数组
a(i) = c(i)
sname(i) = c1(i)
Next
List2.AddItem "姓 名" & " " & "成绩"
For i = 1 To n
List2.AddItem sname(i) & " " & Str(a(i))
Next
End Sub