题库 高中信息

题干

在某银行取款机上,用户银行卡密码验证的过程如下图所示:当用户输入密码时,若第1次输入错误,第2次输入才正确,则整个操作过程的执行流程是(    )
A.①→②→③→④→⑤
B.①→②→③→④→⑥→⑦
C.①→②→③→④→⑥→②→③→④→⑤
D.①→②→③→④→⑥→⑦→②→③→④→⑤
上一题 下一题 0.99难度 选择题 更新时间:2016-03-11 05:06:35

答案(点此获取答案解析)

同类题3

条形码是按照一定编码规则排列的图形标识符。如右图所示,条形码下方数字左边12位代表信息,最右边一位是校验码。校验码产生方法如下:

①把条形码下方数字从右往左依次编序号为“1,2,3,4……”;
②从序号2开始把所有偶数序号位上的数相加求和,并乘以3;
③从序号3开始把所有奇数序号上的数相加求和;
④把第②和第③步结果相加求和;
⑤10减去第④步结果的个位数,得出校验码(如果差值为10,则校验码为0);
如条形码的数字为:977167121601X(X为校验码),则校验码主要产生步骤如下:
1) (1+6+2+7+1+7)×3=72
2) 0+1+1+6+7+9=24
3) 72+24=96
4) 10-6=4
所以最后校验码X=4,此条形码数字为9771671216014。
小何为此编写了VB程序,用以验证条形码输入正确与否。程序运行时,从文本框Text1获取条形码数字部分,单击按钮Command1后,在列表框List1中输出结果。实现上述功能的VB代码如下,但加框处代码有错,请改正。
Private Sub Command1_Click()
Dim i As Integer, b As String, Lb As Integer
Dim s1 As Integer, s2 As Integer, tmp As Integer
Dim c As String
Dim d(1 To 13) As Integer '存储数据
Dim res As String '存储结果
b =" Text1.Text" '输入
Lb = Len(b)
s1 =" 0" : s2 = 0
flag = True
res = "输入错误!"
If Lb =" 13" Then
For i =" 1" To 13
c =" Mid(b," Lb - i + 1, 1)
If c >= "0" And c <= "9" Then
d(i) =" Val(c)" '输入转换
Else
flag =" False" : Exit For
End If
Next i
If flag Then
For i =" 2" To Lb Step 2
s1 =  s1 + d(i) '参数计算1
s2 =s2 + d(i) '参数计算2    ①
Next i
tmp =" s1" * 3 + s2
If tmp Mod 10    Then res = "输入正确!"  ②
End If
End If
List1.AddItem res
End Sub

同类题5

编写VB程序,实现如下功能: 单击“排序数组a”按钮Command1时,对已有数组a的数据进行升序排列,并显示在文本框Label1中;单击“显示数组b”按钮Command2时,将升序数组b的数据显示在文本框Label2中;再单击“合并a和b”按钮Command3时,对数组a和数组b升序合并到字符串中,将合并后的数据在文本框Label3中显示。(运行效果如图所示)。实现上述功能的VB代码如下, 请在划线处填入合适代码。

Dim a(1 To 6) As Integer
Dim b(1 To 6) As Integer
Private Sub Command1_Click() '对数组a中的数据进行排序
Dim i As Integer, j As Integer ,k as integer
a(1) =" 53" :a(2) =" 18:a(3)" =" 62:a(4)" =" 22:a(5)" =" 6:a(6)" = 25
s = ""
For i =" 1" To 5
k = i
For j =" i" + 1 To 6
If a(k) > a(j) Then
Next j
If i <> k Then
t =" a(k):" a(k) =" a(i):" a(i) = t
End If
Next i
For i =" 1" To 6
s =" s" + Str(a(i))
Next i
Label1.Caption = s
End Sub
Private Sub Command2_Click()
b(1) =" 3:" b(2) =" 8:" b(3) =" 15:" b(4) =" 27:" b(5) =" 38:" b(6) = 49
'此处部分代码省略
End Sub
Private Sub Command3_Click()
'将数组a和b中的数据逐个比较后添加到新的字符串s中,并将s在label3中显示
i =" 1:" j =" 1:" s = ""
Do While i <=" 6"     ②   j <= 6   '如果两数组都还有数据未合并
If   ③    Then
s =" s" + Str(a(i)) : i =" i" + 1
Else
s =" s" + Str(b(j)) : j =" j" + 1
End If
Loop
Do While i <= 6 '只有数组a还有数据未合并
s =" s" + Str(a(i)) : i =" i" + 1
Loop
Do While j <= 6 '只有数组b还有数据未合并
s =" s" + Str(b(j)) : j =" j" + 1
Loop
Label3.Caption = s
End Sub