资源描述:
《2009:c语言程序设计(a卷)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、中山大学软件学院2009级软件工程专业(2009秋季学期)《程序设计(I)》期末试题(A卷)(考试形式:闭卷考试时间:2小时)《中山大学授予学士学位工作细则》第六条警示考试作弊不授予学士学位方向:姓名:______学号:SectionA:MultipleChoice(20points)Foreachofthefollowingquestions,chooseonlyONEoftheprovidedmultiple-choice:A,B,C,Dcorrespondingtothebestanswerforthem.1.Whichisanexampleofunaryopera
2、tors?(A)++(B)<=(C)=(D)&&2.Howmanytimeswillthefollowingprogramfragmentprinthello?for(i=2;i<1000;i*=i)printf("hello");(A)4(B)5(C)6(D)Noneoftheabove3.Arecursivefunctionisafunctionthat(A)returnsitself(B)takesafunctionasanargument(C)isinsideofanotherfunction(D)callsitself4.Whichistrue?(A)Anarr
3、aycancontaindataitemsofdifferentdatatypes.(B)Anarraysizecanbechangedafterdeclaration.(C)Thesubscriptforthelastelementofanarrayisthearraysize.(D)Noneoftheabove.5.WhatisNOTabenefitoffunctions?第1页/共6页(A)Makeaprogramfaster(B)Softwarereusability(C)Avoidcoderepetition(D)Divideandconquer6.Assume
4、helloisacharacterarray.WhichofthefollowingoperationsdoesNOTproduceastring?(A)charhello[]={'h','e','l','l','o'};(B)charhello[]={'h','e','l','l','o',' '};(C)charhello[]="";(D)charhello[]="hello";7.Thebinarysearchalgorithm(A)isbettersuitedtosmallarrays(B)isbettersuitedtounsortedarrays(C)can
5、onlybeusedonasortedarray(D)isslowerthanalinearsearch8.IfbPtrisassignedb(thenameofanarray),thenarrayelementb[6]canalternativelybereferencedas:(A)b[bPtr+6](B)*(bPtr+6)(C)*b[bPtr+6](D)bPtr+69.WhichstatementwillNOTcausecompilationerror?(A)inta[][]={1,2,3};(B)inta[2][]={1,2,3};(C)inta[][2]={1,
6、2,3};(D)Noneoftheabove10.Supposewehavethefollowingnodedefinitionsanddeclaration.structnode{inta;structnode*link;}*head,*p,*q;pandqrespectivelypointtotwoadjacentnodes,shownasfollowing:第2页/共6页…………qpWhichofthefollowingstatementsareNOTcorrectstatementstodeletenodep?(A)q->link=p->link;free(p);
7、(B)p=p->link;free(q->link);q->link=p;(C)(*p).link=(*q).link;free(p);(D)p=(*p).link;free((*q).link);(*q).link=p;SectionB:ShortAnswer(40points)Brieflyanswerthequestionsaccordingtherequirements.1.(6points)RepresentthefollowingthreeequationsinCprogramminglanguage.22(a)(