试题

试题 试卷

logo

题型:单选题 题类:模拟题 难易度:困难

浙江省2018届高三上学期信息技术选考试题

【加试题】已知数组a(1)到a(6)的原始数据为”118”,”36”,”98”,”15”,”88”,”2”,对该数组进行排序操作,某同学编写了以下VB程序:

For i=1 to 3

  For j=6 to i+1 step -1

If a(j)<a(j-1) then

       t=a(j): a(j)=a(j-1): a(j-1)=t

End if

  Next j

Next i

则程序运行之后,数组a(1)到a(6)的值依次为(   )

A、”118”,”15”,”2”,”36”,”88”,”98” B、”118”,”15”,”36”,”88”,”98”,”2” C、”2”,”15”,”36”,”118”,”88”,”98” D、”2”,”15”,”36”,”88”,”98”,”118”
举一反三
某次考试的流程为先笔试再面试,笔试成绩达到面试资格线的可以入围参加面试。入围面试的资格线根据计划录取人数的200%划定,即如果考试最终录取x人,则第2*x名选手的笔试分数为面试资格的分数线(该分若有同分者可一同参与面试)。现在编写VB程序功能如下:自动读取数据库中考生考号和笔试成绩,依次存储在数组kh(i)、cj(i)中,并显示在List1列表框中。单击“入围划线”按钮Command1,面试分数线显示在文本框Text2中,入围面试最终人数显示在Text3中,进入面试的考生的考号和笔试成绩显示在List2列表框中,如果成绩相同,则按考号由小到大的顺序显示。程序界面如图所示。

 

Dim kh(1 to 500) As string,cj(1 to 500) As Integer Dim n As Integer    ‘参加考试总人数

Private Sub Form_Load()

Dim conn as new ADODB.connection:Dim rs As New ADODB.Recordset

conn.ConnectionString=“Provider=Microsoft.ACE.OLEDB.12.0;Data Source=”

+App.Path+”\BSCJ.accdb”

conn.Open

set rs.activeconnection=conn

rs.Open“select*FROM scoreinfo”

‘本过程其他代码略 End Sub

Private Sub Command1_Click()

Dim m As Integer,i As Integer,j As Integer

Dim t1 As Integer,t2 As String,flag As Boolean For i = 1 To n-1    ‘排序

For j =      ①         If cj(i)<cj(j) Then

t1 = cj(i):cj(i) = cj(j):cj(j) = t1

t2 = kh(i):kh(i) = kh(j):kh(j) = t2 Elseif cj(i) = cj(j) And kh(i) > kh(j) Then

t2 = kh(i):kh(i) = kh(j):kh(j) = t2

End If Next j

Next i

m =         ②        

If m <= n Then   ‘统计进入面试人数

i = m

flag = False

Do While        ③        If cj(i) = cj(i+1) Then

i = i+1 Else

flag = True End If

Loop

Text2.text = Str(cj(m)) Text3.text = Str(i)

For j = 1 To i

List2.AddItem kh(j) + “ ” + Str(cj(i)) Next j

Else

Text2.Text=”面试人数超过总人数了” End If

End Sub

返回首页

试题篮