问题 填空题

下列给定函数中,函数fun()的功能是:统计字符串中各元音字母(即A,E,I,O,U)的个数。注意:字母不分大小写。例如,输入THIs is a boot,则应输出是1 0 2 2 0。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <conio.h>
#include <stdio.h>
/*************found**************/
fun(char *s, int num[5])
int k, i=5;
for(k=0;k<i;k++)
/*************found**************/
num [i]=0;
for(;*s;s++)
i=-l;
/*************found**************/
switch(s)
case ’a’: case ’A’:i=0;break;
case ’e’: case ’E’:i=1;break;
case ’i’: case ’I’:i=2;break;
case ’o’: case ’O’:i=3;break;
case ’u’: case ’U’:i=4;break;

if(i>=0)
num[i]++;


main ( )
char s1[81]; int num1[5], i;
clrscr ();
printf("\nPlease enter a string: ");
gets (s1);
fun(s1, num1);
for(i=0;i<5;i++) printf("%d",num1[i]);
printf ("\n");

答案

参考答案:错误: fun(char *s, int num[E]) 正确: void fun(char *s, int num[E])
(B) 错误: num[i]=0; 正确: num[k]=0;
(C) 错误: switch(s) 正确: switch(*s)

解析: switch语句说明:
(1)switch后的表达式,可以是整型或字符型,也可以是枚举类型的。在新的ANSIC标准中允许表达式的类型为任何类型。
(2)每个case后的常量表达式只能是常量组成的表达式,当switch后的表达式的值与某一个常量表达式的值一致时,程序就转到此case后的语句开始执行。如果没有一个常量表达式的值与swish后的值一致,就执行default后的语句。
(3)各个case后的常量表达式的值必须互不相同,不然的话程序就不知该跳到何处开始执行。
(4)各个case的次序不影响执行结果,一般情况下,尽量使用出现机率大的case放在前面(为什么,等学到《数据结构》就知道了)。
(5)在执行完一个case后面的语句后,程序流程转到下一个case后的语句开始执行。千万不要理解成行完一个case后程序就转到switch后的语句去执行了。
在本例中,其他错误都比较简单,而且我们在前面已经介绍过了。

完形填空
When I was in primary school, I got into a major argument with a boy named Tom in my class. I can’t remember what it was about,  21 I have never forgotten the  22  I learned that day.
I was 23 that I was right and he was wrong--and he was sure that I was wrong and he was right. The 24decided to teach us a very important lesson. My English teacher, Ms Green  25 both of us up to the 26 of the class and 27  him on one side of her desk and me on  28 . In the middle of her desk was a large, round object. I could  29 see that it was black. She asked the boy what  30  the object was. “White,” he answered.
I couldn’t believe he said the object was white,  31 it was obviously black! Another 32 started between my classmate and me, this time about the 33  of the object.
The teacher told me to go stand where the boy was standing and told him to come stand where I had been. We changed  34  and now she asked me what the color of the object was. I  35 answer, “White.” It was an object with two 36  colored sides, and from his side it was white.  37  from my side was it black.
My teacher taught me a very important lesson that day: You must 38  in the other person’s shoes and look at the 39  through their eyes in order to  40  understand their view.
小题1:
A.andB.but C.soD.or
小题2:
A.textB.lectureC.classD.lesson
小题3:
A.toldB.wished C.convincedD.allowed
小题4:
A.officer B.workerC.doctorD.teacher
小题5:
A.told B.cameC.broughtD.woke
小题6:
A.front B.back C.middle D.side
小题7:
A.plantedB.placed C.hadD.fixed
小题8:
A.another B.other C.the otherD.others
小题9:
A.clearlyB.fortunatelyC.happilyD.nearly
小题10:
A.widthB.shapeC.colorD.size
小题11:
A.ifB.unlessC.untilD.when
小题12:
A.fightB.argumentC.conversationD.game
小题13:
A.colorB.shapeC.sizeD.weight
小题14:
A.placesB.seatsC.attitudesD.glasses
小题15:
A.needed to B.was able toC.hoped toD.had to
小题16:
A.similarlyB.differently C.beautifullyD.surprisingly
小题17:
A.StillB.AlsoC.SinceD.Only
小题18:
A.seatB.standC.lieD.put
小题19:
A.movementB.situationC.conditionD.behavior
小题20:
A.trulyB.suddenlyC.quietlyD.unexpectedly
判断题