问题 填空题

以下程序中函数f的功能是在数组x的n个数(假定n个数互不相同)小找出最大最小数,将其中最小的数与第一个数对换,把最大的数与最后一个数对换。请填空。
#include <stdio.h>
void f(int x[],int n)
int p0,p1,i,j,t,m;
i=j=x[0]; p0=p1=0;
for(m=O;m<n;m++)
if(x[m]>i) i=x[m]; p0=m;
else if(x[m]<j) j=x[m];p1=m;)

t=x[p0];x[p0]=x[n-1];x[n-1]=t;
t=x[pl];x[p1]= 【14】 【15】 =t

main()
int a[10],u;
for(u=0;u<10;u++) scamp("%d",&a[u]);
f(a,10);
for(u=0;u<10;u++)printf("%d",a[u]);
ptintf("\n");

答案

参考答案:x[O][15][答案]x[O]

解析: 根据题意,f()函数要“将其中最小的数与第一个数对换,把最大的数与最后一个数对换”,而填空处的上一行语句正是使用交换算法,将下标为p0的元素与数组x的最后一个元素(n个元素的数组,其最后一个元素的下标为n-1)交换。所以不难得知,填空所在行的语句是要将下标为p1的元素与数组x的第1个元素交换。故两个空都应该填x[0]。

完形填空

.

第三节:完形填空(共20小题;每小题1.5分, 满分30分)

阅读下面短文,掌握其大意,然后从各题所给四个选项(A、B、C和D)中,选出最佳选项。

Once there was a king who liked pictures very much. One day, he    21   a prize to the artist who would paint the best picture of peace. Many artists    22  . The king looked at all the pictures. But there were only two he    23    liked, and he had to choose between them.

One picture was of a calm lake. The lake was a perfect    24    for peaceful towering mountains all around it.    25   was a blue sky with fluffy (蓬松的) white clouds. All who saw this    26    thought that it was a perfect picture of peace.

27    picture had mountains, too. But these were large, rough and    28   . Above was an angry sky, from which rain fell and in which lightning    29  . Down the side of the mountain   30    a foaming (起泡沫的) waterfall. This did not look    31    at all.

But when the king looked    32   , he saw behind the waterfall a tiny    33   growing in a crack in the rock. In the bush a mother bird had built her    34   . There, in the midst of the rush of angry water, sat the mother bird on her nest —    35  perfect peace.

Which picture do you think won the prize? The king    36    the second picture. Do you know why?

“Because,”   37  the king, “peace does not mean to be in a place    38  there is no noise, trouble, or hard work. Peace means to be in the midst of all those things and    39    be calm in your heart. That is the real    40   of peace.”

21. A. afforded                B. offered                C. accepted            D. canceled

22. A. collected             B. planned             C. tried                 D. directed

23. A. hardly                B. slightly         C. really                D. generally

24. A. bowl                  B. mirror               C. plate                 D. cover

25. A. Outward             B. Indoors             C. Overhead          D. Downhill

26. A. prize                  B. result                C. artist                 D. picture

27. A. The one                     B. Another             C. Other                D. The other

28. A. bare                   B. fresh                 C. green                D. distant

29. A. played                B. screamed           C. wandered          D. cheered

30. A. connected           B. floated                     C. fell                   D. rose

31. A. hopeful               B. peaceful            C. successful          D. careful

32. A. regularly             B. suddenly           C. closely                     D. casually

33. A. flower                B. ground                C. tree                   D. bush

34. A. house                 B. business            C. nest                  D. relationship

35. A. of                      B. in                            C. by               D. for

36. A. protect                B. forced               C. depended           D. chose

37. A. explained            B. described           C. reminded           D. persuaded

38. A. which                 B. where               C. whose               D. that

39. A. thus                    B. even                 C. also                  D. still

40. A. story                  B. meaning            C. source               D. history

单项选择题