《完整版C语言英文试题.docx》由会员分享,可在线阅读,更多相关《完整版C语言英文试题.docx(3页珍藏版)》请在第一文库网上搜索。
1、2009-2010学年1学期C语言程序设计(C)课程考试试题拟题学院(系):信息科学与技术学院适用专业:信息08级,通信08级拟题人:校对人:(答案写在答题纸上,写在试题纸上无效)I.Choosetherightanswer(30marks).1. Determinetheoutputofthefo11owingstatement:printf(,%du,M-N);A) ,M,-N,B)M-NB) 3D)12. Whichoffo11owingisani11ega1user-definesymbo1?A)scantB)_123C)C$D)var3. WhichstatementisnotaCs
2、tatement?C)inta;a+;B)z=20,a+=c;C);D);4. Whichoperatorcanon1ybeapp1iedtointegers?A)%=B)/C)=D)=5. Determinetheoutputofthefo11owingprogram.voidmain()(inty=8,=7;printf(%d%dn,+,y+);)A)7,8B)9,7C)8,8D)8,96. Choosethewrongdefinitionforthecharacterstrings.O;A)charstr4=QUST;B)charstr=QUST”;C)char*str=QUST;D)C
3、harSM=QUS,T7. Determinetheoutputofthefo11owingprogram.voidmain()(inti,j,m=0;for(i=1;i=15;i+=5)for(j=3;j15C)18D)258. Forthe2-dimensiona1arrayintb3=1,0,-1,10,12,8,3,9,0;theva1uefortheb21is.A)8B)5C)3D)129. Inthestatementwhi1e(x),choosetheequiva1entexpressionforthex.A)x=0B)x=1C)x!=1D)x!=010. Forthefo11o
4、wingcodes:intz=5,*p=&z;theva1ueofthe*pis.A)theaddressofcB)unknownva1ueC)theaddressofpD)511. Inordertoassign45tovariantaandassign64tovariantbwiththestatementscanf(,%d%d”,&a,&b),whichinputformatiscorrect?A)4564B)45,64C)45;64D)456412. Whatisthebyte1engthofthestringutabcd,.A)6B)7C)8D)913. Determinetheou
5、tputoftheva1ueofb.Inta42=1,2,3,4,5,6,7,8);b=*(*(a+2)+1);A)3B4C)5D)614. Determinetheoutputofthefo11owingprogram:main()(intn=8;whi1e(n5)n-;printf(u%d,1n);)A)876B)765C)8765D)765415. Whatisthefunctiona1ityoffunction,rewind,?A) openthefi1eagain;B) returnthe1engthofthefi1eC) pushthepointertotheendofthefi1
6、eD) pushthepointertothebeginningofthefi1eII.Shortanswerquestions.(30marks)1. a.Enumerateworkf1owcontro1methodsinCprogramming1anguage.(5marks)b.Giveasimp1eCprogramtoshowthebasicpartsofaCprogram.(5marks)2. a.Thefo11owingprogramtakesuserinputnumberanddisp1aythemu1tip1icationresu1tof(num+num)inthenext1i
7、neonthescreen,butita1waydisp1aysthewrongresu1t.Determinewheretheerrorsareandwhytheprogramcannevergivethecorrectresu1t.(8marks)#inc1udevoidmain()intnum;printf(Entera1etter:);scanf(%d,num);num=num*num;printf(Theresu1tofnum+numis%d,&num);)b.ModifytheprogramsoitW川disp1aytheproperresu1t.(12marks)III.Writ
8、etheprograms.(40marks)1. Givenanarraya9,fi11awithrandomva1ues,thenwriteasortingmethodtosortthedatainaanddisp1aytheresu1t.(10marks)2. (a)Writeafunctionnamedmin()thataccepts5integersasinput,whichca1cu1atesandreturnsthemaximumva1ueamongthem.The5integernumbersshou1dbearrangeintoanintegerarray,andpassedt
9、othefunctionmin().(5marks)(b)Inc1udethefunctioninaworkingprogram.Makesureyourfunctionisca11edfrommain()andcorrect1yreturnsava1uetomain().Disp1aytheva1uereturnedbymin()inmain().(5marks)3. Writeaprogramthatdec1aresasing1e-dimensiona1arraysnamednum,.Thenumberstobestoredinnumare45,86,12,37,28,113.Sumoddsandevensseparate1y.Fina11y,givetheresu1tsthatwi11bedisp1ayedonthescreen.(10marks)4. Givenafunction:xx10y2x10x10,x203x100x20Writeaprogramtoaccepttheuserinputforx,anddisp1aytheva1ueofy.