c語言期中考試試題_第1頁
c語言期中考試試題_第2頁
c語言期中考試試題_第3頁
c語言期中考試試題_第4頁
c語言期中考試試題_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、南京郵電大學(xué)通達(dá)學(xué)院2014-15 學(xué)年第 一 學(xué)期高級語言程序設(shè)計(jì)期中考試試卷本試卷共 6 頁;考試時間 100 分鐘;I專業(yè)班級學(xué)號姓名 弊 |3、 C語言對四種基本變量的存儲空間分配從小到大依次為:A) int char float doubleB) char int float doubleC) double float char intD)char double int float:I4、設(shè)i為int型變量,f為float型變量,通過語句 scanf( “i=%d,f=%f ”,&i,&f);希望將I:100和765.12分別賦給i和f,則正確的鍵盤輸入為 。A)100,765.12

2、B) i=100,f=765.12C) i=100 f=765.12D)100 765.12:5、以下對于函數(shù)的描述中正確的是 。A) 函數(shù)必須有參數(shù)。B) 函數(shù)的返回值類型不能為空。C)函數(shù)必須先定義后使用。D)函數(shù)中不能有復(fù)合語句。6、 已知 w=1,x=2,y=3,z=4;條件表達(dá)式(wx?w: y ) c+d?a:bD)11、下列程序的輸出為 。void mai n() int i=0,j=0,a=6;if(+i0)|(+j0)a+;prin tf(i=%d,j=%d,a=%dn,i,j,a);A) i=0,j=0,a=6B) i=1,j=1,a=7C) i=1,j=0,a=7D)i=

3、0,j=1,a=712、若int i=11;執(zhí)行下列程序后,變量 switch(i)的正確結(jié)果是A)case 10: i+=1; case 11: i+=1; defult: i+=1;10B) 11C)12D) 1313、設(shè)有以下程序段,則下面描述中正確的是 。int k=10;while(k=0) k=k-1;A) while循環(huán)執(zhí)行10次B)循環(huán)是無限循環(huán)C)循環(huán)體語句一次也不執(zhí)行D)循環(huán)體語句執(zhí)行一次14、C語言中while和do-while循環(huán)的主要區(qū)別是A) do-while的循環(huán)體至少無條件執(zhí)行一次B) while的循環(huán)控制條件比 do-while的循環(huán)控制條件更嚴(yán)格C) do-

4、while允許從外部轉(zhuǎn)到循環(huán)體內(nèi)D) do-while的循環(huán)體不能是復(fù)合語句15、若有以下程序段,w和k都是整型變量w=k;LB: if(w=0) goto LE ;w-;printf( * );goto LB ;LE:則不能與上面程序段等價的循環(huán)語句是 。A) for(w=k ; w!=0 ; w-)B) for (w=k ; w; -w)print( * );printf( *);do w- ; printf(” *”); while (w!=0);while(w-!=0) printf( *);得分、填空題(20*2分)1、C語言程序的基本單位是 _(1)_。一個C語言程序必須有一個 _

5、(2)_o2、常量有很多不同的類型,#define PI 3.1415中的PI通常稱為 _ (3)_常量。3、定義變量x=3, y=3, z=2,執(zhí)行語句x/=y%=z+=z*z ”后,x的值為_ (4)_, y的值為 _d o4、下面語句執(zhí)行結(jié)果的第一行和最后一行分別是 int i,j;for (i=0,j=5;i=3;i+,j-)printf (%dn,i*8/j);(6)一o5、以下程序?qū)崿F(xiàn)這樣的功能:商店賣西瓜,10斤以上的每斤0.15元,8斤以上的每斤0.3元,6斤以上的每斤0.4元,4斤以上的每斤0.6元,4斤以下的每斤0.8元,從鍵盤 輸入西瓜的重量和顧客所付錢數(shù),則輸出應(yīng)付款和

6、應(yīng)找錢數(shù)。請補(bǔ)全程序。#include” stdio.h ”void mai n() float weight, mon ey, rate;pri ntf( ” the paid money of the client is:scanf( ” f”,&money);printf( ” the weight of the watermelon is:scanf( ” f”,&weight);if (一(8一)rate=0.15;else if (weight8)rate=0.3;else if (weight6)_ 49)_;else if (weight4)rate=0.6;_(10_););

7、自 覺 遵裝 守 考 試 規(guī) 則 誠 信 考 試 絕 不 作 弊printf( printf( rate=0.8;” the account payable is %f” the change is %fn”,moneyn-weight*rate);,weight*rate);自覺遵裝守考訂試線規(guī)則內(nèi)誠不信考要試,答絕不題作弊6、 下列程序的輸出結(jié)果為_ (11)。#i ncludevoid mai n() int k=0; char c=A:doswitch(c+) caseA:k+;break;caseB:k-; caseC:k+=2;break; caseD:k=k%2;co nti n

8、ue; caseE:k=k*10;break;default:k=k/3;I k+;while(cG);prin tf(k=%dn,k);|:7、 以下程序運(yùn)行輸出的第一行是_(12)_,第二行是(13)_ ,第三行是(14)_#i ncludeint i,j=2;void p(void) for(i=0;i4;i+)| prin tf(%d,+j);if (i+1)%2=0) pri ntf( n);void mai n() for(i=0;i3;i+)p();printf(” %d n ,i);8、 以下程序運(yùn)行輸出的第一行是_(15)_,第二行是(16)_ ,第三行是 (17)_#inc

9、lude” stdio.h ”void mai n()un sig ned int a=65535;int b=-1;char c= a;printf(a=%d,a=%o”,a,a);printf(b=%d,b=%u”,b,b);printf(c=%d,c=%c,c,c);i9、以下程序運(yùn)行的結(jié)果_(18)_。#include” stdio.h ”void mai n() int i=1,sum=0;sum+=i;i+; goto loop;prin tf(sum=%dn,sum);10、以下程序?qū)崿F(xiàn)輸出如下圖形的功能,請補(bǔ)全程序。* * * * * * *#i nclude void mai

10、 n() int i,j;for(i=1;(19);i+)for(j=1;j=i;j+)printf(* ”;_(20) _、編程題(2*15分)1、編程實(shí)現(xiàn),找出1100之間的前10個偶數(shù)并輸出。2、編寫函數(shù)fun,完成計(jì)算1+2+n值的功能,再編寫主函數(shù)驗(yàn)證之。要求: 在主函數(shù)中完成n的輸入以及計(jì)算結(jié)果的輸出功能。When you are old and grey and full of sleep,And no ddi ng by the fire, take dow n this book,And slowly read, and dream of the soft lookYour

11、eyes had on ce, and of their shadows deep;How many loved your mome nts of glad grace,And loved your beauty with love false or true,But one man loved the pilgrim soul in you.And loved the sorrows of your cha nging face;And bending dow n beside the glow ing bars,Murmur, a little sadly, how love fledAn

12、d paced upon the mountains overheadAnd hid his face amid a crowd of stars.The furthest dista nee in the worldIs not betwee n life and deathBut whe n I sta nd in front of youYet you dont know thatI love you.The furthest dista nee in the worldIs not whe n I sta nd in front of youYet you cant see my loveBut whe n un doubtedly knowing the love from bothYet cannot be together.The furthest dista nee in the worldIs not being apart while being in loveBut whe n I pla inly cannot resist the year ningYet prete n

溫馨提示

  • 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。