资源描述:
《浙江大学c程2002b试卷e》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、《CProgramming》TESTPAPERTime:8:30-10:30am.June20,2003Importantnote:youranswersmustbewrittenontheanswersheetSection1:SingleChoice(1markforeachitem,total10marks)1.Theprecedenceofoperator_____isthelowestone.A.<
2、010LC.10D.1.03.Theexpression!(x>0
3、
4、y>0)isequivalentto_____.A.!(x>0)&&!(y>0)B.!x>0&&!y>0C.!x>0
5、
6、!y>0D.!(x>0)
7、
8、!(y>0)4.Thevalueofexpression______isn’t0。A.1/2B.!’ ’C.!EOFD.NULL5.Ifxisafloatvariable,thevalueofexpression(x=10/4)is_____。A.2.5B.2.0C.3D.26.Ifvariablesaredefin
9、edandassignedcorrectly,theexpression______iswrong.A.a&bB.a^bC.&&xD.a,b7.Accordingtothedeclaration:inta[10],*p=a;theexpression______iswrong.A.a[9]B.p[5]C.*p++D.a++8.______iswrong.A.charstr[10];str="string";B.charstr[]="string";C.char*p="string";D.char*p;p="string";9.Ifa
10、llvariableshavebeendefinedanddeclaredinthefollowingprogram,allthevariableswhichcanbeusedinfunctionfun()are______.#includevoidfun(intx){staticinty;……return;}intz;voidmain(){inta,b;fun(a);……}A.x,yB.x,y,zC.a,b,y,zD.a,b,x,y,z10.Accordingtothedeclaration:intp[5],*a
11、[5];theexpression______iscorrect.A.p=aB.p[0]=aC.*(a+1)=pD.a[0]=2《CProgramming》TESTPAPER,June20,20039/8Section2:Fillintheblanks(2markforeachitem,total30marks)1.Accordingtothedeclaration:inta[2][3][4],thenumberofelementsofarrayais___24__.2.Writingconditionalexpression___
12、(x>0)?1:(x==0)?0:-1___tocalculatethevalueofy.1x>0y=0x=0-1x<03.Thevalueofexpression1<10<5is__1___.4.Thevalueofexpression~(10<<1)&4is___0___.5.Thevalueofexpressionsizeof(“hello”)is___6___.6.Theoutputofthefollowingstatementsis__k=10,s=25___.intk,s;for(k=1,s=0;k<10;k++){if
13、(k%2==0)continue;s+=k;}printf("k=%ds=%d",k,s);7.Theoutputofthefollowingstatementsis__47___.#defineMM(x,y)(x*y)printf("%d",MM(2+3,15));8.Theoutputofthefollowingstatementsis__k=1s=30___.intk=1,s=0;switch(k){case1:s+=10;case2:s+=20;break;default:s+=3;}printf("k=%ds=%d",k,
14、s);9.Theoutputofthefollowingprogramis__1#2#3#___.#includeintf(){staticintk;return++k;}voidmain(){intk;for(k=