问题 单项选择题

有以下程序:
struct STU
char name[10];
int num;
int score;

main()
struct STU s[5]="YangSan",20041,703,"LiSiGuo",20042,580,
"WangYin",20043,680,"SunDan",20044,550),
’Penghua",20045,537,*p[5],*t;
int i,j;
for(i=0;i<5;i++) p[i]=&s[i];
for(i=0;i<4;i++)
for(j=i+1;j<5;j++)
if(p[i]->Score>p[j]->Score)
t=p[i];p[i]=p[j];p[i]=t;
printf("%d %d\n",s[1].Score,p[1]->Score);

执行后输出结果是( )。

A.550 550

B.680 680

C.580 550

D.580 680

答案

参考答案:C

解析: 本题中首先定义了结构体类型STU,该结构体由一个长度为10的字符数组、两个整型变量num和Score组成。在主函数中,定义了一个长度为5的结构体数组s并赋初值,一个指针数组p和一个指针变量t,接着将数组s中各元素的地址依次赋给指针数组p中的各成员。然后通过两个for循环将数组p按Score的值从小到大的顺序排列。因此最后输出的 p[1]->Score的值为550,而数组s[1].Score的值为580,所以,4个选项中选项C符合题意。

阅读理解

Three men traveling on a train began a conversition about the world's greatest wonders.

“ In my opinion,” the first man said, “ the Egyptian pyramids are the world’s greatest wonder. Although they were built thousands of years ago, they are still standing. And remember: the people who built them had only simple tools. They didn’t have the kind of machinery that builders and engineers have today.

“ I agree that the Egyptian pyramids are wonderful,” the second man said, “ But I don’t think they’re the greatest wonder. I believe computers are more wonderful than the pyramids. They have taken people to the moon and brought them back safely. They carry out mathematical calculations in seconds that would take a person a hundred years to do.”

He turned to the third man and asked, “ What do you think is the greatest wonder in the world?”

The third man thought for a long time, then he said, “ Well, I agree that the pyramids are wonderful, and I agree that computers are wonderful, too. However, in my opinion, the most wonderful thing in the world is the thermos(保温瓶).”

And he took a thermos out of his bag and held it up.

The other two men were very surprised. “ A thermos?” they exclaimed(大声说), “ But that’s a simple thing.”

“ Oh, no, it’s not,” the third man said, “ in the winter you put in a hot drink and it stays hot, in the summer you put in a cold drink and it stays cold. How does the thermos know whether it is winter or summer?”

小题1:The travelers passed the time on the train by talking about _______.

A.the journey

B.the train

C.themselves

D.wonderful things小题2:The three men could not agree on what the world’s greatest wonder was because _______.

A.they could not think of anything very wonderful

B.they all had different ideas

C.they could not prove that their opinions were right

D.the journey ended too soon小题3: The first man thought the pyramids were the most wonderful things in the world because _______.

A.they were very beautiful

B.they were Egyptian

C.they had been built with very simple tools

D.they could do mathematical calculations小题4:The third man thought a thermos was the most wonderful thing in the world because _______.

A.it lasted longer than the pyramids

B.it cost less than a computer

C.he thought it knew whether it was winter or summer

D.the other two men were surprised when he told them about it小题5:The third man was not very clever because _______.

A.he could not think of anything to say

B.he did not understand how a thermos works

C.he did not think the pyramids were wonderful

D.he did not know anything about computers

单项选择题