问题 填空题

下面程序用“冒泡”法将数组a中的10个整数按升序排列,算法是:从数组的第1个元素开始,依次将相邻的两个数相比较(第1个数与第2个数,第2个数与第3个数……如此重复),若前面的数较大,则这两个数交换位置。这样执行一遍后,最后一个数已经是数组中最大的数。然后将数组的前n-1个数重复上述过程。如此继续,可将数组排序,请将程序补充完整。
Option Base 1
Private Sub Command1_Click()
Dim a()
a=Array(678,45,324,528,439,387,87,875,273,823)
Fori= 【10】
Forj= 【11】
If a(j) 【12】 a(j+1)Then
a1=a(j)
a(j)=a(j+1)
a(j+1)=al
End lf
Nextj
Next i
For i=1 To 10
Print a(i)
Next i
End Sub

答案

参考答案:[10]1 To 9
[11]1 To 10-i
[12]>=或>

解析: 本题主要考查了“冒泡”排序法,根据题意描述的“冒泡”法的思想,对10个数进行排序,需要进行9趟排序过程,故[10]处填1 To 9。每一趟中都需要进行一定次数的两数比较,如第一趟过程中需要对前9个数进行相邻数两两比较,第二趟中对前8个数进行相邻数两两比较,依此类推,总结规律可知 [11]处应填1To 10-i。比较中两数交换位置的前提条件是前面的数大于后面的数或大于等于后面的数。故[12]处应填>=或>。

完形填空

After supper Mrs. Bell felt hot and came out of the hotel. She got to   1  a week ago. She liked the city and went traveling there for   2  first time. Now she was walking along a quiet street when she saw a man working in a garden. She   3   to watch him carefully. The old man worked   4   and she was sure he was an able gardener. She liked to see him.

“I have a garden, too.” The woman said to herself. “ I   5  such a gardener. Why don’t you bring one to America?”

So she went into the garden and said she would pay him much if he    6   to go to America with her.

“ I’ll pay for your fare(费用), too.” said the woman. “ You’ll be able to get   7   soon in my country, I think.”

“ Thanks a lot,” said the old man, “but it’s    8   that I already have another position(职位). I can’t give it up. I’ll have to work for you   9   they elect(选举) me next time.”

“Oh?” the woman said in surprise. “    10  are you, then?”

“The president of France.”

小题1:A. Toronto             B. Paris                C. Moscow

小题2:A. a                       B. /                    C. the

小题3:A. ended                   B. went on              C. stopped

小题4:A. slowly                  B. hard                 C. badly

小题5:A. need                    B. hope                 C. hate

小题6:A. disliked                B. agreed               C. believed

小题7:A. lonely                 B. happy                C. rich

小题8:A. glad                    B. unlucky              C. lucky

小题9:A. until                  B. unless               C. if

小题10:A. Whose                  B. How                  C. What

单项选择题