書籍編號 | 書名 | 作者 | 是否借閱 | 借閱日期 | 定價 | 借閱人編號 |
2018000001 | 我們仨 | 楊絳 | 是 | 2020/6/8 | ¥28 | Xr0236 |
2018000002 | 邊城 | 沈從文 | 否 | ¥32 | ||
2019000003 | 流星雨 | 三毛 | 否 | ¥30 | ||
2019000004 | 人生 | 路遙 | 是 | 2020/7/18 | ¥26 | Cd0765 |
…… | …… | …… | …… | …… | …… |
下列說法正確的是( )
ch = Mid(s, i, 1)
If ch >= "0" And ch <= "9" Then
k = (Val(ch) - 1) Mod (Len(s) - 4) + 1
s1 = Mid(s, k, 1) + s1
End If
Next i
Text1.Text = s1
程序執(zhí)行完后,Text1 中顯示的內容是( )
a(1) = 23: a(2) = 32: a(3) = 46: a(4) = 38: a(5) = 15: a(6) = 55: a(7) = 39
For i = 1 To 5
For j = 2 To 7-i
If a(j) > a(j + 1) Then
t = a(j): a(j) = a(j + 1): a(j + 1) = t
c = c + 1
End If
Next j
Next i
c 的初值是0,程序執(zhí)行完后,c的值是( )
k=0:s = Text1.Text For i = 0 To Len(s)-1
①
If ch >= "a" And ch <= "z" Or ch >= "A" And ch <= "Z" Then
word = word + ch
Else
For j = 1 To k
If ② Then Exit For
Next j
If ③ Then
k = k + 1
a(k) = word
End If
word = ""
End If
Next i
Text2.text=str(k)
則①②③處的代碼為( )
Dim a(1 To 8) As Integer Dim i, j, m, k As Integer i = 1: j = 8
a(1) = 87: a(2) = 66: a(3) = 59: a(4) = 40: a(5) = 39: a(6) = 30: a(7) = 22: a(8) = 13
k = Val(Text1.Text)
Do While i <= j
m = (i + j + 1) \ 2
If a(m) < k Then
j = m - 1
Else
i = m + 1
Loop
Text2.Text = Str(i)
程序執(zhí)行完后,i的值是4,則k的值不可能是( )
圖 b
程序代碼如下,請回答如下問題:
Const n = 6
Dim i, j, k As Integer Dim s As String
Dim a(1 To n * n) As Integer
Private Sub Command1_Click()
For i = 1 To n * n
Randomize
a(i) = Int(Rnd * 90) + 10
For j = 1 To i - 1
If a(j) = a(i) Then
a(i) = Int(Rnd * 90) + 10
End If
Next j
s = s + Str(a(i))
IfThen
List1.AddItem s
s = ""
End If
Next i
End Sub
Private Sub Command2_Click()
For i = 1 To n * n
k = i
For j = i + 1 To
If a(k) > a(j) Then k = j
ElseIf a(k) Mod 2 = 0 and a(j) Mod 2 = 1 Then k = j
End If
Next j
If k <> i Then t = a(k): a(k) = a(i): a(i) = t
Next i
End Sub
‘將有序的數據輸出在 List2 中,代碼略
①將發(fā)送信息中的每一個字符的八位二進制取反
②第1、2、4、8位上插入4個二進制數,若取反后的八位二進制數中1的個數是偶數,插入的4個二進制是1、0、1、0,否則是0、1、0、1
③將12位二進制分為3段(4位一段),每一段的最后一個數字移動到最前面,并將移動后的4位二進制數抓換為十六進制數,轉換后的3位十六進制數即是加密后的字符字符"A"的加密過程如下表所示:
原文“A”轉換成8位二進制數取反 |
1 0 1 1 1 1 1 0 |
插入4位二進制數1、0、1、0 |
1 0 1 1 0 1 1 0 1 1 1 0 |
4位1段,最后一個數字移動到最前面 |
1101 0011 0111 |
轉換為十六進制數,即密文 |
D37 |
按照上述規(guī)則,小明設計了一個加密的VB程序,程序功能如下:在Text1中輸入待加密的字符,單擊“加密”按鈕,將加密后的字符顯示在Text2中,程序運行界面如下圖所示,請回答如下問題:
Private Sub Command1_Click()
Dim i As Integer, j As Integer, k As Integer Dim m As Integer, n As Integer, t As Integer Dim count As Integer
Dim a(1 To 12) As Integer
Dim mingw As String, miw As String
mingw = Text1.Text
For i = 1 To Len(mingw)
n = Asc(Mid(mingw, i, 1))
j = 8
Do While
a(j) = (n + 1) Mod 2 count = count + a(j)
n = n \ 2
j = j - 1 Loop
For k = 1 To 4
m = 8 + k - 1
Do While m >= 2 ^ (k - 1)
a(m + 1) = a(m)
m = m –1
Loop
Next k
For t = 1 To 3
miw =
Next t
Text2.Text = miw
Next i
End Sub
Function rev_btoh(b(i) As Integer, start As Integer, ending As Integer) As String
Dim i, sum As Integer
Const code = "0123456789ABCDEF"
sum = b(ending)
For i = start To ending - 1
sum = sum * 2 + b(i)
Next i
rev_btoh = Mid(code, sum + 1, 1)
End Function