c語言教學(xué)必備(TheessentialofClanguageteaching)_第1頁
c語言教學(xué)必備(TheessentialofClanguageteaching)_第2頁
c語言教學(xué)必備(TheessentialofClanguageteaching)_第3頁
c語言教學(xué)必備(TheessentialofClanguageteaching)_第4頁
免費預(yù)覽已結(jié)束,剩余33頁可下載查看

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

c語言教學(xué)必備(TheessentialofClanguageteaching)Name:LiuJianclass:0802“CprogramminglanguagerandomtopicWorktime:2009-4-249:30:00to2009-5-623:30:001.whenperformingthefollowingproceduresection{y=-l;Do{y—while(—y);};Printf(%d\n,y-);}(3points)A,B,C,D,the body of the loop will beexecuted oncethe body of the loop will beexecuted twotimesthe body of the loop will executeindefinitelythe systemwill promptsyntaxerrorTheoutputofthe2.istheresultofthefollowingprocedure(main){inti;For(i=l;I<6;i++){if(i%2){printf("#");continue;}Printf("*");)Printf("\n");(3)B,C,D,A,#*#*######miss?井?#*AssumethataandB3.intvariables,carryoutthefollowingstatementafterthevalueofBA=l;b=10;Do{b=b~a};a++;While(b—>0);(3points)A,B,C,D,-3-2-1-4Theoutputofthe4.istheresultofthefollowingprocedure(main){inti;For(i='A';IぐI';i++,i++)printf(%c,i+32);Printf("\n");}(3points)A,B,C,D,A,thecompilerdoesnotpass,nooutputC,AcegiD,abcdefghi5.iftheinputisABCdeffollowingaprogram,theoutputis:(main){charch;While((ch=getchar)(='\n')!){if(CHくch>='A'&&='Z'ch=ch+32);Elseif(CHぐz'>='a'&&chch=ch-32);Printf(%c,CH);}Printf("\n");}(3points)A,B,C,D,A,ABCdefB,abcDEFC,ABCD,DEFTheoutputofthe6.istheresultofthefollowingprocedure{inti,J,x=0;For(i=0;I<2;i++){x++;For(j=0;J<3;j++){if(j%2)continue;X++;)X++)Printf(x=%d\n,X);}(3points)A,B,C,D,A,x=4B,x=8x=6x=12Pleasereadtheprogram7:#include(main)(Floatx,y,z;Scanf &x,&y);Z=x/y;While(1){if(Fabs(z)>1.0)X=y;y=z;z=xElsebreak;Printf(%f\n,y);)Iftheoperationofthekeyboardinputfromthe3.62.4(saidreturn),thentheoutputresultis(3points)B,C,D,A,1.5000001.60000022.400000Theoutputofthe8.istheresultofthefollowingprocedure(main){intnum=0;While(Num<=2){num++;printf(%d\n,num);(3points)A,B,C,D,F,1TwoThreeFour1TwoThree1Two1F,Xandyarevariablesoftypeint,isperformedunderthecycle,yvalueFor(y=l,x=l;y<=50;y++){If(x>=10)break;If(x%2==l){x+=5};continue;X-=3;}(3points)A,B,C,D,2468Theoutputofthe10.istheresultofthefollowingprocedure(main){inti,a[10];For(i=9;i>=0;i—)a[i]=10-i;Printf(%d%d%d,a[2],a[5],a[8]);(3points)B,C,D,F,A,258741852369F,Theoutputofthe11.istheresultofthefollowingprocedure(main){inti,J,x=0;For(i=0;I<2;i++){x++;For(j=0;J<3;j++){if(j%2)continue;X++;}X++)Printf(x=%d\n,X);}(3points)B,C,D,A,x=4x=8x=6x=12Theoutputofthe12.istheresultofthefollowingprocedure(main){inti,K,a[10],p[3];For(i=0;I<3;i++)p[i]=a[i*(i+1)];For(i=0;I<3;i++k=k+p[i]*2);Printf(%d\n,K);)(3points)A,B,C,D,2021222313.readthefollowingprocedures:(main){intn[3],I,J,k;N[i]=O;K=2;For(i=0;I<K;i++)For(j=0;J,2;j++)N[j]=n[i]+1;Printf(%d\n,n[l]);}Theoutputistheresultofprogramrunning(3points)B,C,D,A,2103Theoutputofthe14.istheresultofthefollowingprocedure(main){intx=10,y=10,in;for(i=0;x>8;y=++in)printf("%d%d”,x,y);)(3分)a、b^c^d、a>10192b>987610990101091c語言中while和dowhile循環(huán)的主要區(qū)別是(3分)a、b、c、d、a、do-while的循環(huán)體至少無條件執(zhí)行一次b、while的循環(huán)控制條件比dowhile的循環(huán)控制條件更嚴(yán)格c、do-while允許從外部轉(zhuǎn)到循環(huán)體內(nèi)d、do-while的循環(huán)體不能是復(fù)合語句16.下面程序的運行結(jié)果是main(){charch[7]={"65ab21”};inti,s=0for(i=0;ch[i]>=’〇'&&ch[in]<'9';+=2)s=10*s+ch[i]-'0'printf("%d"n",s);)(3分)a、b、c、d、12ba566521c、6d、62main(){intx;for(i=1;in<=50;i++){x=i;if(x%2==0)if(x%2==0)if(x%7==0)printf("%d”,in);)}輸出結(jié)果是(3分)a、b、c、d、a、28c、42d、41.以下程序段 x=-1;die{x=X*X;}while(!x);(3分)a、b、c、d、a、是死循環(huán)b、循環(huán)執(zhí)行二次c、循環(huán)執(zhí)行ー次d、有語法錯誤.以下程序段的輸出結(jié)果是intx=3;die{printf("%3d”,x=2);}while(!(-x));(3分)a、b、c^d、a、1b、3,0c、1,-2d、死循環(huán).當(dāng)執(zhí)行以下程序段時x=-1;do{x=x*x;}while(!x);(3分)a、b、c、d、a、循環(huán)體將執(zhí)行一次b、循環(huán)體將執(zhí)行兩次c、循環(huán)體將執(zhí)行無限次d、系統(tǒng)將提示有語法錯誤.有如下程序main(){inta[3][3]={{1,2},{3,4},{5}},,j,s=0;for(i=1;in<3;i++)for(j=0,jくi;j++)s+=a[i][j]printf("%d"n",s);)該程序的輸出結(jié)果是(3分)a、b、c、d、f、a、14b、19c、20D,21F,letKbeaplastic,belowisthewhileloop(time)K=2;while(k==0){printf(%d,K);k一:}Printf("\n");(3points)B,C,D,A,unlimited012runthefollowingprogram,iftheinputfromthekeyboard6514<enter>,outputresults(main)(Intm,n;Printf("Entermn:");Scanf(%d%d,&m,&n);While(m=n!)While(M>n)m-=n;While(n>m)n-=m;)Printf(m=%d\n,m);}(3points)B,C,D,A,m=3m=2m=lm=0Thefollowing24.loopexecutiontimesis(main){inti,j;For(i=0,j=l;i+=2,I<=j+1;j—)Printf("%d\n",I);}(3points)B,C,D,A,3210Thefollowingprogramisoutput25.(main){intx=3,y=6,a=0;While(x++!=(y-=l))(A+=l;If(yxbreak);Printf(x=%d,y=%d,a=%d\n,x,y,a);(3points)A,B,C,D,x=4,y=4,a-1x=5,y=5,a=lx=5,y=4,a=3x=5,y=4,a-126.ifthefollowingstatementIntx=3;Do{printf(%d\n,x-=2);}while((--x)!);Istheaboveprogram(3points)B,C,D,A,theoutputis1theoutputis1and-2theoutputis3and0isthecycleofdeathThefollowingprogramisoutput27.(main){Inty=9;For(;Y>0;y一)iIf(y%3==0){printf(%d,一y);continue;})}(3points)A,B,C,D,A,741B,852C,963D,875421thefollowingprocedures(main){intn=9;While(n>6){n—;printf(%d,n);})Theoutputoftheprogramistheresultof(3points)B,C,D,F,A,98787687659876F,Thefollowing29.loopexecutiontimesis(main){intI,j;For(i=0,j=l;I<=j+1;i+=2,j—)Printf("%d\n",I);}(3points)A,B,C,D,3210Theoutputofthe30.istheresultofthefollowingprocedure(main){inti;For(i=l;我V6;i++){如果(我2){printf(“ザ’);繼續(xù);}printf(“*”);)printf("\n");)(3分)ー個、BCD、、、ー個、#**##U####*****##***《程序設(shè)計語言C》固定題目31〇下面程序的功能是:計算1到10之間奇數(shù)之和及偶數(shù)之和,請?zhí)羁铡?包括〈stdio.h>main(){inta,b,c,我;A=C=0;為(i=0;我〈10;我+=2){:+我;C=C+B;)printf("偶數(shù)之和二%d\n",A);printf(“奇數(shù)之和二%d\n",C);}(3分)答:32〇下面程序的輸出是int屯(intnum){intk=1;做{K=K?民%10;Num=民/10;}而(民);返回(K);)main(){intn=26;printf("%d”,屯(n));}(3分)答:33〇讀以下程序說明和C程序填空程序說明:本程序判斷M是否為素數(shù)。程序:#包括main()intm,I,K;scanf("%d”,(1);K=(2);為(i=2;i<=K;i++)如果((3))扌丁破;如果((4))printf("%d是素數(shù)、n,m);elseprintf(u%d不是素數(shù)、n,m);)(3分)答:34〇讀以下程序說明和C程序填空程序說明:用n/4=1/3+1/5-1/7+…公式求證n的近似值,直到最后ー項的絕對值小于10E-6為止。程序:#包括くく數(shù)學(xué)?!眒ain()int的;浮N,T,PI;T—1;PI=(1);n=1;S=1;而((2)){ji=ji+T;例⑶;S二(4);T二(5);)ji=jiX4;printf(“PI=%10.6f\n",PI);)(3分)答:35〇下面程序功能是:輸出100以內(nèi)能被3整除且個位數(shù)為6的所有整數(shù),請?zhí)羁铡?包括くstdio.h>main(){inti,j;為(i=0;(1);i++){j=我?10+6;如果((2))繼續(xù);printf("%d”,J);}}(3分)答:36〇ー球從100m高度自由落下,每次落地后又回跳到原高度的一半,再落下,求它在第!0次落地時共經(jīng)過多少M?第10次反彈多高?程序如下:主要(){浮法錫=100,HN=錫/2;intn;對于(n=2;n<=100;n++){(一);(b);}printf(“第10次落地時共經(jīng)過%FM\n",SN);printf(“第10次反彈

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論