图书编号 | 图书名称 | 借阅人 | 借书日期 | 还书日期 | 是否损坏 |
JS0001 | Python编程从入门到实践 | 黄晓琳 | 2019-5-14 | 2019-6-5 | 否 |
JS0002 | 深入理解Java虚拟机 | 李语敏 | 2019-11-21 | 2019-12-25 | 是 |
…… | …… | …… | …… | …… | …… |
JX0712 | 历史的原声 | 王甜甜 | 2020-1-19 | 2020-6-1 | 否 |
以下有关“小微图书管理系统”和Access数据表结构设计描述正确的是( )
音频 | 编码标准 | 采样频率 | 量化位数 | 声道 | 时长 | 是否压缩 |
A | PCM | 22.05kHz | 16bit | 单声道 | 40秒 | 不压缩 |
B | PCM | 44.10kHz | 8bit | 双声道 | 10秒 | 不压缩 |
则这两段音频文件的存储容量之比(A :B)约为( )
Private Sub Command1_Click ()
Dim x As Integer,r As Integer, s As String
x = Val(Text1. Text): s =""
Do While x<>0
r=(x+1) Mod 2
s=Str(r)+s
x=x\2
Loop
Text2. Text = s
End Sub
该程序段运行后,在文本框Text1中输入25,则文本框Text2显示的内容是( )
Private Sub Command1_ Click( )
Dim a(1 To 10) As Integer, i As Integer, k As Integer
a(1)=1:a(2)=17:a(3)=8:a(4)=9:a(5)=18
a(6)=15:a(7)=20:a(8)=13:a(9)=7:a(10)=11
k=0
For i= 2 To 9
If(a(i)-a(i-1))*(a(i+1)-a(i))< 0 Then k=k+1
Next
Text1. Text = Str (k)
End Sub
该程序段运行后后,文本框Text1中显示的内容是( )
Const n = 100
Dim a(1 To n) As String
Private Sub Command1_ Click( )
i=1:j = ⑴
flag = False
Key = Val (Text1. Text)
Do While i <= j And Not flag
m= ⑵
If Val(a(2 * m)) = Key Then
List1. AddItem a(2* m-1)+””+ a(2* m): flag =True
Else
If ⑶ Then j= m-1 Else i=m+1
End If
Loop
If Not flag Then List1. AddItem”没有找到!”
End Sub
上述程序段(1)、(2)、(3)三个方框处的语句依次为( )
①j=n ②j=n/2
③m=(i+j)\2
④m=((i+j)\2)*2
⑤Val(a(2 * m)) < Key
⑥Val(a(m)) < Key
⑦Val(a(2 * m)) > Key
请回答下列问题:
以下有关图表的描述正确的是 (多选,填字母)。
算法分析:要使得到的5位数字最小,首先需保证能取到5个数字,且首位应尽量小,那么取首位数的范围应保证余下有4个数字,即在前4位中选最小非0的数字。
程序运行时,在文本框Text1中输入一个数字字符串,在文本框Text2中输入要移除的数字个数,单击“运行”按钮CmdRun后,在标签Label1显示得到的最小新数,程序运行界面如图b所示。
Private Sub CmdRun_Click( )
Dim Num As String,New_num As String ' Num为输入的数字字符串
Dim i As Integer, j As Integer, m As Integer,
Dim As Integer, s As Integer, k As Integer
Dim a(30) As String, b(30) As Integer
Num = Text1. Text: s = Len(Num)
k = Val (Text2. Text) 'k为删除数字个数
For i=1 To s
a(i) = Mid(Num,i,1)
Next
j =1
m=1
n=
For i=m+1 To n '取第一个非零最小数字
If Then m=I '加框处程序代码有误,请改正
Next i
b(j)= m
Do While '取其他最小数字
m=m+1
n=n+1
For i=m+1 To n
If a(i) < a(m) Then m= i
Next i
j =j+1:b(j)=m
Loop
For i= m+1 To s '最后直接取的数字
j =j+1:b(j)=i
Next i
For j=1 To s- k '输出最小数
New_num =
Next j
Label1.Caption = New_num
End Sub
按上述要求,编写一个VB程序,功能如下:程序运行时从数据库中读取志愿者的检测号、
DNA序列存入相应数组,在文本框Text1中输入抗体DNA序列,单击“检测结果”按钮Command11,在列表框List1中按检测号顺序显示每个志愿者的检测结果,并在标签Label1显示疫苗抗体的阳性率(以百分比表示,并保留2位小数),程序运行界面如图所示,请在划线处填入合适的代码。
Dim Pnum(1 To 100) As String 'Pnum数组存储志愿者的检测编号
Dim Pch(1 To 100) As String 'Pch数组存储志愿者的DNA序列
Dim Prs(1 To 100) As String 'Prs数组存储志愿者的检测结果
Dim n As Integer '存储志愿者的总人数
Private Sub Form_ Load( )
Dim i As Integer, j As Integer
Dim tmp As String, chtmp As String
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Conn.ConnectionString = "Provider=Mi crosoft. ACE.OLEDB.12. 0;Data Source=" + App.Path+"\DNADB.accdb"
Conn.Open
Set Rs.ActiveConnection = Conn
Rs.Open "SELECT * FROM Source" '从数据库的名为 “Source”数据表中读取数据
i =0
Do While Not Rs.EOF
i=i+1
Pnum(i) = Rs.Fields(0)
Pch(i) = Rs.Fields(1)
Rs.MoveNext
Loop
Rs.Close
Conn.Close
n=
For i=1 To n-1 '以检测号作为关键字对DNA序列数据进行升序排列
j=i+1
Do While j <= n
If Then
chtmp = Pch(i):Pch(i)= Pch(j):Pch(j)= chtmp
tmp = Pnum(i):Pnum(i)= Pnum(j):Pnum(j)= tmp
End If
j=j+1
Loop
Next i
End Sub
Private Sub Command1_ Click( )
Dim Ach As String, RVch As String, Vch As String
Dim i As Integer, j As Integer, k As Integer, m As Integer
Ach = Text1. Text: s = Len(Ach): RVch = Ach + Ach
k=0:m=0
For i=1 To n
If Len(Pch(i)) <= Len (Ach) Then
k =k+ 1: Prs(i) = “无效”
Else
For j=1 To s '按环状序列依次进行比较
Vch =
If Test(Vch,Pch(i)) Then
m=m+1
Prs(i) =“阳性”: Exit For
Else
Prs(i) =“阴性”
End If
Next j
End If
Next i
For i =1To n
List1. AddItem Pnum(i) +" " + Prs(i)
Next i
Label1. Caption = Str(Int(m/(n-k)*10000 +0.5)/100) + "%"
End Sub
Function Test(str1 As String,str2 As String) As Boolean '字符串比对函数
Dim i As Integer
Test = False
For i = 1 To Len(str2) - Len(str1) + 1
If Then
Test = True: Exit For
End If
Next i
End Function