书籍编号 | 书籍名称 | 书籍作者 | 收藏日期 | 书籍价格 | 是否借出 | 借阅人 |
1 | 永远有多远 | 铁凝 | 2020/11/15 | 16.00 | 是 | 杨云海 |
2 | 中国文化精神 | 张岱年,程直山 | 2021-2-1 | 45.00 | 否 | |
3 | 张炜文集5 | 张炜 | 2021-4-5 | 25.00 | 是 | 余桌远 |
4 | 太阳发芽 | 红柯 | 2021-6-18 | 30.00 | 否 | |
…… |
下列关于该班级图书管理信息系统的描述,正确的是( )
Dim i As Integer, n As Integer, k As Integer, s As String n = Val(Text1.Text):k = 1: s = ""
Do While 2 ^k < n
k = k + 1
Loop
Do While n <> 0
If n >= 2 ^ (k -1) Then s = s + "1"
n = n - 2 ^ (k -1)
Else
s = s + "0"
End If
k = k - 1
Loop
For i= 1 To k
s = s + "0"
Next i
在文本框Text1输入12,执行该程序段后,变量s、k的值分别为( )
Dim x As Integer, result As String,p As String, k As String result = "":p = Text1.Text:k = Text2.Text
For x = 1 To Len(p) -Len(k) + 1
If ⑴ Then
result = result + Mid(p, x, 1)
Else
⑵
End If
Next x
Text3.Text = ⑶
上述程序段中横线处可选语句为:
① Mid(s, x, Len(k)) = k
② Mid(s, x, Len(k)) <>k
③ x = x +Len(k) – 1
④ x = x + Len(k)
⑤ result + Mid(p, x)
⑥ result
则(1)(2)(3)处填入的语句依次为( )
key = Val(Text1.Text)
i = 1: j = 8
Do While i <= j
m = (i + j) \ 2
If a(m) < key Then j = m - 1 Else i = m + 1
Loop
数组元素a(1)到a(8)存放着非升序排列的数字,执行上述程序段后,下列说法错误的是( )
y = Val(Text2.Text)
For i = ⑴
For j = ⑵
If a(j) > a(j + 1) Then
a(j) = a(j) + a(j + 1):a(j + 1) = a(j) - a(j + 1):a(j) = a(j) - a(j + 1)
End If
Next j
Next i
上述程序段中横线处可选语句为:
①(1)1 Toy–x (2)xTo y – i
②(1)x toy-1 (2)y -1to x + i -1 step -1
③(1)1 Toy–x (2)x toy + x –i – 1
④(1)x toy-1 (2)y-1 to i step -1
则(1)(2)处依次填入的语句组合正确的有( )
图b
内码(十六进制) |
CA |
B1 |
二进制 |
11001010 |
10110001 |
后5位十进制 |
10 |
17 |
前3位十进制 |
6 |
5 |
加密结果 |
10,6,17,5 |
按照上述规则,小明设计了一个解密的VB程序,功能如下:单击“解密”按钮,程序依次将文本框Text1中的字符提取,进行解密处理,并输出在文本框Text2中,程序效果如图a所示,请回答下列问题
Private Sub Command1_Click()
Const n = 100
Dim s As String, ch As String, nm As String
Dim p As Integer, i As Integer, k As Integer, t As Integer Dim a(1 To n) As Integer
s = Text1.Text p = 0: k = 0
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "0" And ch <= "9" Then
Else
If k Mod 2 = 1 Then
Else
a(k+1) = p
End If
k = k + 1:p = 0
End If
Next i
a(k + 1) = p * 32 + a(k)
For i =
nm = nm + dtoh(a(i))
Next i
Text2.Text = nm
End Sub
Function dtoh(x As Integer) As String Const
st1 = "0123456789ABCDEF"
Do While x > 0
x = x \ 16
Loop
End Function
Dim xm (1 To 1000) As String, bj(1 To 1000) As Integer
Dim tc1 (1 To 1000) As String, tc2(1 To 1000) As String ,n As Integer
Private Sub Form Load( )
'从数据库中按班级、学号有序地读取学生的姓名、班级、中午套餐、晚上套餐,依次存入xm、bj、tc1、tc2数组中,总人数存入n中,部分代码如下,其余代码略
Dim conn As New ADODB.Conncction
Dim rs As New ADODB.Recordset
conn ConncctionString = "provider=Microsoft.ACE.OLEDB.12.0;data source=" + "jiucan.accdb"
conn.Open
Set rs.ActiveConnection = conn
End Sub
Private Sub Command1_Click()
Dim k As Integer, i As Integer, t As Integer, m As Integer, s1 As String, s2 As Integer Dim zc (1 To 4) As Integer, wc (1 To 4) As Integer '用于统计套餐数量
Dim bs (0 To 20) As Integer , ljs (0 To 20) As Integer
t = Val (Text1. Text):m = 0
For i = 1 To 4 '为数组赋初始值
zc(i) = 0: wc(i) = 0
Next i
For i = 0 To 20 '为数组赋初始值
bs(i) = 0: ljs(i) = 0
Next i
For i = 1 To n – 1 '按班级编号进行升序排序
For j = i To n- 1
If bj(j) < bj(k) Then k = j
Next j
s1 = xm(i): xm (i) = xm (k): xm (k) = s1
s2 = bj(i): bj (i) = bj (k): bj (k) = s2
s1 = tc1(i): tc1 (i) = tc1 (k): tc1 (k) = s1
s1 = tc2(i): tc2 (i) = tc2 (k): tc2 (k) = s1
bs(bj(i)) = bs(bj(i)) + 1
If bs(bj(i)) = 1 Then
Next i
bs(bj(i)) = bs(bj(i)) + 1
For i = 1 To m
Next i
For i = ljs(t) - bs(t) + 1 To ljs(t)
zc(fx(tc1(i))) = zc(fx(tc1(i))) + 1
wc(fx(tc2(i))) = wc(fx(tc2(i))) + 1
Next i
'查询班级的用餐情况,在列表框 List 中输出,代码略
End Sub
Function fx(a As String) As Integer
End Function