资源描述:
《《C Programming》TEST PAPER》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、《CProgramming》TESTPAPERTime:8:30-10:30am.June20,2003Importantnote:youranswersmustbewrittenontheanswersheet Section1:SingleChoice(1markforeachitem,total10marks)1.1. Theprecedenceofoperator_____isthelowestone.A.<
2、.1.03.3. 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.4. Thevalueofexpression______isn’t0。A.1/2B.!’ ’C.!EOFD.NULL5.5. Ifxisafloatvariable,thevalueofexpression(x=10/4)is_____。A.2.5B.2.0C.3D.26.6. Ifvariablesaredefine
9、dandassignedcorrectly,theexpression______iswrong.A.a&bB.a^bC.&&xD.a,b7.7. Accordingtothedeclaration:inta[10],*p=a;theexpression______iswrong.A.a[9]B.p[5]C.*p++D.a++8.8. ______iswrong.A.charstr[10];str="string";B.charstr[]="string";C.char*p="string";D.char*p;p="string";9.9. Ifall
10、variableshavebeendefinedanddeclaredinthefollowingprogram,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.10. Accordingtothedeclaration:intp[5],*a[5];theexpression______i
11、scorrect.A.p=aB.p[0]=aC.*(a+1)=pD.a[0]=2 Section2:Fillintheblanks(2markforeachitem,total30marks)1.1. Accordingtothedeclaration:inta[2][3][4],thenumberofelementsofarrayais_____.2.2. Writingconditionalexpression______tocalculatethevalueofy.1x>0y=0x=0-1x<03.3. Thevalueofexpression1
12、<10<5is_____.4.4. Thevalueofexpression~(10<<1)&4is______.5.5. Thevalueofexpressionsizeof(“hello”)is______.6.6. Theoutputofthefollowingstatementsis_____.intk,s;for(k=1,s=0;k<10;k++){if(k%2==0)continue;s+=k;}printf("k=%ds=%d",k,s);1.7. Theoutputofthefollowingstatementsis____
13、_.#defineMM(x,y)(x*y)printf("%d",MM(2+3,15));2.8. Theoutputofthefollowingstatementsis_____.intk=1,s=0;switch(k){case1:s+=10;case2:s+=20;break;default:s+=3;}printf("k=%ds=%d",k,s);3.9. Theoutputofthefollowin