资源描述:
《c期末复习资料_2009精简_》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、复习资料(2009.5)第一章C语言基础1)int,char,float,doubleareallbasicdatatypesinClanguage.(对)2)Providedthatthelengthofintis16bits,thenthevaluescopeofunsignedintis:(B)A.0~255B.0~65535C.-32768~32767D.-256~2553)Thedeclarationis:intk=0,a=0,b=0;
unsignedlongw=5;
doublex=1.42,y=0;
thentheincorrectexpressi
2、onis_A__A.y=x%3B.w+=-2C.x=w+5D.k*=a+b4)InC,basicdatatypesareint,char,floatand_double_____.5)Givendeclaration:charc=’ 35’;thesizeofcis__1____bytes.混合数据类型的运算1)Supposedeclaration:chara=’c’;thenstatement:printf(“%d”,a);iswrong.(错)2)Supposedeclaration:inta;floatx,y;thentheresultdatatypeof
3、expression:x+a%3*(int)(x+y)%2/4is_float_____.3)Thedatatypeofexpression:18/4*sqrt(4.0)isfloat.(错)字符的ASCII值及其合理应用1)Supposedeclaration:chara;thenexpression:ch=’5+9’iscorrect.(错)
2)ASCIIof‘A’is65.thenreadthefollowingprogramandtheresultofit.
Filltheblanks:
main()
{
chara;
a=’A’+__11____;
p
4、rintf(“%c”,a);
}
result:L3)Togetacharacterwithgetchar(),youcaninputcorrespondingASCIInumberofthedesiredcharacterfromkeybord.(错)1)Supposedeclaration:
inta;
floatf;
doublei;
thentheresultdatatypeofexpression:
10+’a’+i*fis__double____.1.常量字符常量的定义形式:#definePRICE3022字符常量定义后,在程序中不能再改变其值,如PR
5、ICE++是错误的。1)Incorrectstringconstantis:(A)字符串常量A.‘abc’B.“1212”C.“0”D.“”2)IfRateisasymbolconstant,wecanuseitasRate++.(错)1.变量其值可以改变的量称为变量。一个变量应该有一个名字,在内存中占据一定的存储单元,在该存储单元中存放变量的值。变量与声明:1)Asvariablename,tmpvarandTmpVararesame.(错)2)Keywordscanbeusedasvariablenames.(错)3)Thefirstcharacterofva
6、riablenamemustbealetteroraunderscore(_).(对)4)Whichofthefollowingiserror?(A)A.Keywordscanbeusedasvariablenames.B.Wetendtouseshortnamesforlocalvariables,especiallyloopindices,andlongernamesforexternalvariables.C.Uppercaseandlowercaselettersinvariablenamesaredistinct.D.Thefirstcharactero
7、fvariablenamemustbealetteroraunderscore(_).变量赋初值1)Thestatement:intn1=n2=10;iscorrect.(错)2)Thedeclaration:floatf=f+1.1;iscorrect.(错)3)Whichofthefollowingistheillegalvariablenames?(D)A.LadB.n_10C._567D.g#k转义字符的应用1)Supposedeclaration:charc=’ 10’;thenthecountofcharacterinvariablecis___1_
8、__.当变