c语言期末试卷含答案(某大学C语言期末复习题及答案-3)
闲来无事,做做别人家的期末试题,没有答案,自己做的,可能有错,欢迎指正。
【单选题】【单选题】
【单选题】
【单选题】
【单选题】
【单选题】
【单选题】
【单选题】
【单选题】
【单选题】
【单选题】
【判断题】
结构是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 ("s==\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
,免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com