还剩13页未读,继续阅读
本资源只提供10页预览,全部文档请下载后查看!喜欢就下载吧,查找使用更方便
文本内容:
Tru e/Fais e
1.F I den tif i ers consist of I e tters a n d d i gits in anyord er,but mustb e in I o we r case.
2.TWe cr ea t e mo dula rprograms beeause t h eyare easierto develop,co rre c t and mod i fy.
3.F Allcompu tersusetwicet h e amo unt ofs t orag e fo rdoub I e prec isio n than floa ti ngpoint data t ype
4.FSt atic variab I eis n o tcreated anddes t ro ye d eacht ime t he f un ction is cailed,it is th e de f ault storage class u sed byC.
5.T Acompo und s t atemen t maybe useda nyw here inCprog r a min pI a ce of a single state me nt.
6.Fln Clang uage,a I I ope r ato r s a reb in a ryope rato rwhich conne cting t ow opera nds s i d e-by-si d e.k=12,C programk=936,123,48Irogram comp u t e rv.Che ck Error i n the prog ram ac cor ding t o the follow!n gdesc r i ptionand correctthem,w rite the whole corr ected p rog ra m on t h e answersheetA programme rwa nts to wr ite a programt osimulate a roI I of th e dice.T heprogrammer d ec id es tohove th eprogram c hoose two pse u d o-rondo mnumber sfrom1to6and outputthe two numb ers.I ftwo val u es ar et h e sa7me,th epro g ram shouldals oo utputt h e st r i n gT h at sa pair!afte rp rinting t hetwo v alue s.The pro gra mmerwrit es the f ollow i n g cod e:#i nc Iude stdio.h#in cI udes t dlib.h#incl udetime.hi ntmai n vo id0int dice
[2];srandtime NULL;forx=0;x=2;x++;匕冈=»016rci nd%6;p r in t f Youroll eda%d anda%d.\n,dice
[0],dice
[1];if dice
[0]=dice[l]printffTha t sapai r!\n;re tur n0;The above code has5e rrors in it!What ar ethe y没有定义x应改为f or x=0;x=2;x++;for x=0;x=2;x++应改为dice[x]=r and%6;dic e[x]=ra nd%7+1/*超纲*/应改为f orx=0;x=2;x++;x Y2巳[应改为==if diee
[0]=d101]vi.Wr it inga programW riteacom pI et ep rog ramth at aI Iow s t h e userto e nt er a st r ing assumedto be I ess t han25c haractersIo ng.If Nist h e leng t hof t h estring,th epro gram should outp ut Nrows tost a n dard output.The first row s hould b ethe string enter©d bytheuser.The seco nd r owshould b eth estring wit ho ut itslastchar acte r.The th i rdr o wsho u I dbethe stringwithout itslastthtwo cha racte rs.Etc.The Nand f i nalr owshou Idbe o n lythefirs tleft ero f thestri n g.Here isas amplerun,as s u min gt heuser types“H ello Wor Id!”w hen prompted:E nte ra str i ng:Hei Io World!Hei Io World!H eI IoWorldHello WorlHeI IoWorHello WoHelloWHelloHei IoHei IHeiHeHPr et est andp os tiest Io op;modu Iar progra ms:bi nar yope rotor;fil e;t he amount ofstora g e;conti nue br e aksta t em e nt;Automatic vari ab Ie;symbolic na me;arra yname;E xte r nstor age class;Iden ti fiers;Es cape Sequence;cont ro Istring;u nion;co mpoundstotement;member s ofastru cture;源代码#i ncl udestdi o.h#i ncludestri n g.h#de fineN25char a[N];in ti,j;getsa;fori=0;is trIena-1;i++一{forj=0;j strIena-i-1;j++p ri ntf%c,a[j];printf\n;}
7.TT he Escape Seq uence isacombinatio nsofabackslash\a nda charoctert hattel Ist he compilesto esc a pefrom t he waysthese characterw ould benormally inte rpr eted
8.T Ex ter n storagecl as sisto e xte ndth es copeof agloba Iv ari ablebeyond itsn ormal bound ary-file,it doesnot causeth ecrea ti ono fanew variable.
9.F Af terdefined,thesymb oli cnames canbeus ed ina nystatement andthe programcan chan get heva lueo fthesy mb o licna mes.
10.TThe mistake of usi ngtheassi gnme ntop erat of=二=in pI aceofthe relat ional operator”uI tsi nresa invalid Cex p ressi on
11.Cho icen.CFor thealgebraic expr e ssi on3ae/b c,whichof thef o llowing Ce x pr ess i on isi nvalid*A a/b/c*e*3o B3*e/b/c A C3*a*e/b*c Da*e/c/b*
312.DFor thedeci arations:cha rw;in tx;fl oat y;d oublez;the datat ype of thev alueofw*x+z-y isAA floatBc harC inhD double
13.B For foilowing de cloration,whi chex press ionwilI notresu It in3intx
[10]={0,1,2,3,4,5,6,7,8,9},*p1A x
[3]B p1=x+3,*pl+++plC p1=x+2,*pl++D p1=x+2,*+
14.AWhic hone isno te ndlessIo op Af泠or y=0,x=1;x++y;x=i++i=x Bfor;;x++=i;C whi Ie1{x++;}A Df ori=10;;i--sum+=i;
15.B Theres uItof thef ollowi ng program is^m ain{in t-2,b a时泠i f!b printfelse prin;tf“*”}w hi Iea1#*####A}B}*#C D***ns is
16.DW hi choneofthefo Ilowingfuncti ovali dAdouble fun int x,i ntyint{z=x+y;ret urn z;}A Bfun卜x,y{int z;二ret urn z;}A Cfun x,yX泠{i ntx,y;double zz+y;ret ur nz;}retD dou bIe funi ntx,int y{dou blez;A z=x+y;if aurnz;}ions
17.D Inasou rcecodes file ofClang uage va riable5ofcan only beusedby aIIfunc twith thefile it self,the storageclass theva ri able isAext㊀rnB regi ster;ymC autoo D static
15.B The C programm ing language the“二boI isAration aIope rator^B logicalope rotor,C conditionalope ratorD assignm ento perat orDForthe defini tion statement:do ubIes=
123.5;,
19.w h ich one isthec orrectout p ut stateme ntuK,A printf s=%d,sB pr in tf s=%Ids;ACpu,5,rint fs=%f,s Dpr intfs=%lf”s;C Whichof thef ollowing expres sionswill resuit in
20.0A3%5B3/
5.0C35D35m.Fi II inthebl an ksineach prog r amto impI ementthe purpose accordingto thedes criptio nDescription#l:The followingprogramcan accept eIeme nts ofan array fromthe keybo ard,and fi ndthe maximume lementandcor resp on dingindex inthe array.main{intx[l0],*pL*p2,k;fork=0;k10;k++scan f11%d,x+k;for p1=xp2=x;pl-x10;pl++if*p1*p2p2=z
[21];pr int ffMAX=%d,INDEX=%d\n*p2,
[22];,}A p1B p2[p1]C x[p2]oD x
21.-PlA p1-x oB plCp2-x Dx-p
222.Description#2:For eachx thepr ogr amwil Ic alc ulate azcorrespond ing yacc ordingtotherelat ionsh ip ofx andyiIlustrated in thefollow ingtabi e.yX2x v=10xx+2-1x=22xx=-1x-1main{int x,y;%,s cn f“d”x;if
[23]y=x*x+2;elseif
[24]y=2*x;eIse ifx=-1y=x-1;els e
[25];%ify!=-1pr intfd”,y;;else pr intffer ror A x2||x=10B x2x
23.=IO C x2x10D x2||x=10Ax-1||x=2^B x-1||x=
224.八八C x-1x=2D x-1x=2A y=-1By=0Cx=0Dx=-
125.1Wh atis thep urpo seofthefollowingprogram#in clude stdio.h#d efineN10ma inintt,i,j,a[N+1]printfplease inputlOintege rs:n;f ori=1;i=N;i++,scan f%d”a[i];pr intf il\nn;for i=1;i=N-l;i++{for j=l;j=N-i;j++if aD]a[j+l]{t=a[j+l];a[j+l]=a[j];a[j]=t;}%,fo ri=1;i=N;i++printfda[i];pri ntf\n;从大到小排列数字2Read the grogramand guessthe resultof theprogram#inc Iude stdio.hintk=1;c hara[]=IBM comp uter b[]=C program”;zintfuc;main{intp=3;o while putc hara[k]k++;/*k=l2*/»putcharn;,pri nt fk=%d,”k;k=fucp;,printf u%d,%d\n”p,k;,printf%c%sn”Q
[0],b[p];putsa
[3];}intfuc intmintk=0;while pu tcharb[k]k++;printf k=%d\nk;zk+=m;m*=k;print f%d,%d\n”,m,k;q return m+k;OUTPUT:BM comp uter。
个人认证
优秀文档
获得点赞 0