资源描述:
《昆明理工大学c语言复习资料》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、复习资料第一章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;thent
2、heincorrectexpressionisAA.y二x%3B.w+二-2C.x二w+5D.k*二a+b4)InC,basicdatatypesareint,char,floatand.double•5)Givendeclaration:charc=, 35thesizeofcisJbytes・混合数据类型的运算1)Supposedeclaration:chara=^c9;thenstatement:primf(“%cT;a);iswrong.(辛昔)2)Supposedeclaration:int
3、a;floatx,y;thentheresultdatatypeofexpression:x+a%3*(int)(x+y)%2/4isfloat.3)Thedatatypeofexpression:18/4*sqrt(4.0)isfloat.(错)字符的ASCII值及其合理应用1)Supposedeclaration:chara;thenexpression:^=^5+9^iscorrect.(错)2)ASCIIof'A,is65.thenreadthefollowingprogramandtheresu
4、ltofit.Filltheblanks:main(){chara;a二'A'+11:printf(“%c”,a);}result:L3)Togetacharacterwithgetchar(),youcaninputcorrespondingASCIInumberofthedesiredcharacterfromkeybord.(错)1)Supposedeclaration:inta;floatf;doublei;thentheresultdatatypeofexpression:10+'a'+i*fi
5、sdouble1.常量字符常量的定义形式:#definePRICE30字符常量定义后,在程序屮不能再改变其值,如PRICE++是错误的。1)Incorrectstringconstantis:(A)字符串常量A.'abc'B.“1212"C.“0"D.“"2)IfRateisasymbolconstant,wecanuseitasRate++.(错)1.变量其值可以改变的量称为变量。一个变量应该有一个名字,在内存屮占据一定的存储单元,在该存储单元中存放变量的值。变量与声明:1)Asvariablename
6、,tmpvarandTmpVararesame・(错)2)Keywordscanbeusedasvariablenames・(错)3)Thefirstcharacterofvariablenamemustbealetteroraunderscore(_).(对)1)Whichofthefollowingiserror?(A)A・Keywordscanbeusedasvariablenames.B・Wetendtouseshortnamesforlocalvariables,especiallyloopin
7、dices,andlongernamesforexternalvariables・C.Uppercaseandlowercaselettersinvariablenamesaredistinct.D.Thefirstcharacterofvariablenamemustbealetteroraunderscore(_).变量赋初值1)Thestatement:intn1=n2=10;iscorrect.(错)2)Thedeclaration:floatf二f+1.1;iscorrect.(错)3)Whic
8、hofthefollowingistheillegalvariablenames?(D)A.LadB.n_10C._567D.g#k转义字符的应用1)Supposedeclaration:charc=, 10';thenthecountofcharacterinvariablecis].当变量成为计数器和累加器的时候如何初始化1)Whenweusesumasanaccumulatingoracounting,weshould