闲来无事,做做别人家得期末试题,没有答案,自己做得,可能有错,欢迎指正。
【单选题】【单选题】【单选题】【单选题】【单选题】【单选题】【单选题】【单选题】【单选题】【单选题】【单选题】【判断题】结构是C语言中一种新得构造数据类型。
【判断题】结构数组名作函数参数时,传递得是该结构数组首地址。
【判断题】结构指针可以作为函数参数进行参数传递,传递得是地址。
【判断题】函数得参数传递有值传递与地址传递两种形式。
【判断题】实参是结构数组名,形参必须是该结构类型数组。
【填空题】【填空题】下列程序得功能是输入5个联系人信息,统计年龄分布情况。请填空。
struct address { char street [20]; int code; int zip;};struct nest_friendslist { char name [10]; int age; char telephone [13];struct address addr;} f;int main (void) { int i,count1,count2,count3; countl =count2 =count3= 0;; for (i=1;1<=5;i++) { scanf ("%s%d%s",f.name,&f.age,f.telephone); ______________ ; if (f.age>=55) count1++; else if (f,age>=40) count2++ else count3++;} printf ("老年人:%d,中年人数:%d,青年人数:%d\n",count1,count2 ,count3 ); return 0;}【填空题】
下列程序得功能是输人某班学生得姓名及数学、英语成绩。计算每位学生得平均分,然后输出平均分蕞高得学生及数学,英语成绩。请填空。
struct student {char name [10];int math,eng;float aver;};int fun (struct student s [ ],int n) { int k,maxsub=0; for(k=0;k<n;k++) { __________ =(s[k].math+s[k].eng)/2.0; if( __________ )maxsub=k; } return maxsub;} int main (void){int i,n,maxn;struct student s [50];scanf ( "%d",&n);for(i=0;i<n;i++) scanf ("%s%d%d",s[i].name,&s[i].math,&s[i].eng);__________; printf ("%10s%3d%3d\n ",s[maxn].name,s[maxn]. math,s[maxn]. eng);return 0 ; }【填空题】【填空题】【填空题】
以下程序读入时间数值,将其加1秒后输出,时间格式为hh:mm:ss,当小时等于24置为0。
struct { int hh,mm,ss;}time;int main(void){ scanf("%d:%d:%d",&time.hh,&time.mm,&time.ss); time.ss++; if( ___________ ==60) { ___________ ; time.ss=0; if(time.mm==60) { time.hh++; time.mm=0; if( __________ ) time.hh=0; } } printf("%d:%d:%d",time.hh,time.mm,time.ss);}
参考答案:
1-5:ABBBA(1题存疑,编译出错是因为少了个分号)
6-10:ABDBA(6题存疑,优选A,D项似乎也对)
11:A(11题,++p->x,运算符优先级->高于前++)
12-16:对对对对错
17:struct DATE d={2009,10,1}
18:scanf("%s%d%d",f.addr.street,&f.addr.code,&f.addr.zip)
19:第1空 s[k].aver 第2空 s[k].aver>s[maxsub].aver 第3空 maxn=fun(s,n)
20:2002Lisi
21:21
22:第1空 time.ss 第2空 time.mm++ 第3空 time.hh==24






