欢迎来到天天文库
浏览记录
ID:13927771
大小:102.00 KB
页数:8页
时间:2018-07-25
《期末试卷高级语言程序设计_(b卷)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、试卷编号:(B)卷课程编号:课程名称:高级语言程序设计考试形式:闭卷适用班级:姓名:学号:班级:学院:专业:考试日期:题号一二三四五六七八九十总分累分人签名题分404020100得分考生注意事项:1、本试卷共8页,请查看试卷中是否有缺页或破损。如有立即举手报告以便更换。2、考试结束后,考生不得将试卷、答题纸和草稿纸带出考场一、FundamentalConceptsofC(40Points).得分评阅人1.(3Points)ThefollowingCprogramiscompiledandrunssuccessfully. Writetheo
2、utputthatthisprogramproduces. #includemain(){inta;floatb; a=7.0/3.0;printf(“%d”,a); a=9%4;printf(“%d”,a);b=4+7.0/2;printf(“%.1f”,b);}第8页共8页2.(4Points)ThefollowingCprogramiscompiledandrunssuccessfully. Writetheoutputthatthisprogramproduces. #includem
3、ain(){intx=4;inty=4;if((x<=y)&&(x>=y)) printf(“Bingo”);else printf(“Nogo”);}3.(6points)Variablesa,b,andcareintegerswherea=3,b=4andc=5respectively.DothefollowingCexpressionsevaluatetotrueorfalse?Youanswersshouldbeeithertrueorfalse. a)a
4、
5、b+c&&b==cb)!(x=a)&&(y=b)&&0
6、c)!(a+b)+c-1&&b+c/24.(4Points)Thecodefragment(below)hasanerror.Changeonecharactertoremovetheerror. inttotal[15];intfactor1[15];intfactor2[15];inti; for(i=0;i<=15;i++)total[i]=factor1[i]+factor2[i]+factor2[i/2];5.(8Points)ThefollowingCprogramiscompiledandrunssuccessfully.Wr
7、itetheoutputthefollowingprogramproduces.#include#defineNRows8main(){inti,j;for(i=1;i<=NRows;i++){for(j=0;j8、bleminimum(floata;floatb) (b.)floataverage(intx,y) (c.)voidproduct(inta,intb); 7.(4Points)Thefollowingcodecontainsaloop.RewritetheloopusingaFORinsteadofaWHILE,keepingtheoutputthesame.Also,whatistheoutputoftheprogram? #include main(){intn;intmult=1; n=1;while(n<59、){mult=mult*n;n++;} printf("Answeris%d",mult);}8. (2points)ThefollowingCprogramiscompiledandrunssuccessfully.Writetheoutputthefollowingprogramproduces. #includemain(){intk=8printf("%d",k++);printf("%d",++k); }9.(3points)Assumewehavedeclaredthetwodimensional10、arrayAintheClanguage, inta[3][4];Whichoneisincorrecttorefertotheelementofthearray?a)a[0][
8、bleminimum(floata;floatb) (b.)floataverage(intx,y) (c.)voidproduct(inta,intb); 7.(4Points)Thefollowingcodecontainsaloop.RewritetheloopusingaFORinsteadofaWHILE,keepingtheoutputthesame.Also,whatistheoutputoftheprogram? #include main(){intn;intmult=1; n=1;while(n<5
9、){mult=mult*n;n++;} printf("Answeris%d",mult);}8. (2points)ThefollowingCprogramiscompiledandrunssuccessfully.Writetheoutputthefollowingprogramproduces. #includemain(){intk=8printf("%d",k++);printf("%d",++k); }9.(3points)Assumewehavedeclaredthetwodimensional
10、arrayAintheClanguage, inta[3][4];Whichoneisincorrecttorefertotheelementofthearray?a)a[0][
此文档下载收益归作者所有