问题 填空题

下列给定程序中,函数fun的功能是:将s所指字符串的正序和反序进行连接,形成的新串放在t所指的数组中。
例如,当s所指字符串为“ABCD”时,t所指字符串中的内容应为“ABCDDCBA”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#include<string.h>
/*************found****************/
void fun(char s,char t)

int i,d;
d=strlen(s);
for(i=0;i<d;i++)
t[i]=s[i];
for(i=0;i<d;i++)
t[d+i]=s[d-1-i];
/************found**************/
t[2*d-1]=’\0’;

main()

char s[100],t[100];
printf("\nPlease enter string S:");
scanf("%s",s);
fun(s,t);
printf("\nThe result is:%s\n",t);

答案

参考答案:(A)void fun (char*s,char*t)
(B)t[B*d]=’\0’;或t[d+i]=’\0’;或t[B*d]=0;或t[d+i]=0;

解析: (1)从调用函数来看,函数传递的是数组,所以函数的形参应为指针。
(2) 循环结束后回文字符的个数为2*d个,因为数组下标是从0开始的,所以最后一个字符的下标为2*d-1,在最后一个字符的后面加上结束符’\0’,因此为t[2*d]=’\0’;。

完形填空
完型填空
从A,B,C,D四个选项中选择能填入空白处的正确答案,并将其字母代号填入答题卷相应空格内。
Many parents want their children to be famous one day. But do children have the same  1  ?
A new   2  —Hi, Ke'ai is on at Beijing Children's Art Theatre. It tells the story of a boy called Ke'ai. His parents would like him to become a painter or a   3  one day. They teach him to   4  and to play the violin, but Ke'ai doesn't enjoy these activities. Then one day Ke'ai's parents see Liu Xiang win a gold   5  at the Athens Olympic Games, and they want him to be a sportsman.
"   6  do they want me to be someone else?" Ke'ai asks and says, "I only want to be
   7  ."
The play shows us that it is good for parents to learn to   8  their children. It helps parents to think about what kids want to do.
Young audiences(观众)enjoy the story, and also the   9  in the play. There are two songs in the play. One of them, "Ke'ai's Song" is very   10  to learn, so the audiences can sing the song on their way home after the play!
小题1:
A.jobsB.dreamsC.habitsD.hobbies
小题2:
A.songB.filmC.playD.opera
小题3:
A.writerB.teacherC.sportsmanD.musician
小题4:
A.paintB.writeC.runD.drive
小题5:
A.matchB.ringC.medalD.race
小题6:
A.How B.WhyC.WhenD.Where
小题7:
A.myselfB.differentC.aloneD.great
小题8:
A.encourageB.understandC.criticizeD.inspire
小题9:
A.lightB.clothesC.skillD.music
小题10:
A.easyB.difficultC.importantD.necessary
问答题 案例分析题