版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、c語言程序設(shè)計a課程試卷(6)題 號一二三四五總 分得 分2011年7月考 一、單選題(每小題2分,共20分) 1. c語言程序中的基本功能模塊為( )。 a. 表達式 b. 標識符 c. 語句 d. 函數(shù) 2. 邏輯表達式(x0 | y=5)的相反表達式為( )。a. x=0 | y!=5 b. x0 | y!=5 d. x0 & y=5 3. 循環(huán)體至少被執(zhí)行一次的循環(huán)語句為( )。 a. for b. while c. do-while d. 任一種循環(huán) 4. 假定n的值為5,則表達式n+的值為( )。 a. 6 b. 5 c. 4 d. 7 5. 假定一個二維數(shù)組的定義為“int a3
2、4=3,4,2,8,6;”,則元素a20的值為( )。 a. 0 b. 2 c. 4 d. 6 6. 假定一個函數(shù)原型為“char* func(int n)”,則該函數(shù)的返回類型為( )。 a. int b. int* c. char d. char* 7. 假定a為一個字符數(shù)組名,則元素ai的指針訪問方式為( )。 a. a+i b. *(a+i) c. &a+i d. *a+i 8. 假定有語句為“int *p=calloc(10+20,sizeof(int);”,則p所指向的動態(tài)數(shù)組中所包含的元素個數(shù)為( )。 a. 10 b. 20 c. 30 d. 40 9十進制數(shù)50表示成符合c語
3、言規(guī)定的八進制數(shù)為_。 a. 20 b. 32 c. 62 d. 062 10. 若要以讀和寫兩種操作方式打開一個二進制文件,當文件不存在時返回打開失敗信息,則選用的打開方式字符串為( )。 a. r+ b. ab+ c. rb+ d. wb+ 二、填空題(每小題2分,共26分) 1. 在一個c語言程序文件中,若要包含另外一個頭文件或程序文件,則應(yīng)使用的預處理命令為_。 2. 用于從鍵盤上為變量輸入值的標準輸入函數(shù)的函數(shù)名為_。 3. 假定一個枚舉類型的定義為“enum raab,ac,ad,ae;”,則ac的值為_。 4double類型的長度為_。 5. 執(zhí)行“int x=45,y=13;p
4、rintf(%d,x/y);”語句序列后得到的輸出結(jié)果為_。 6. 把表達式x=x+y轉(zhuǎn)換成復合賦值表達式為_。 7. 假定x的值為5,則執(zhí)行“a=(!x? 10: 20);”語句后a的值為_。 8. 假定一維字符指針數(shù)組的定義為“char* a8;”,則該數(shù)組占用的存儲空間的字節(jié)數(shù)為_。 9. 假定二維數(shù)組的定義為“double amn;”,則數(shù)組元素的行下標取值范圍在_之間。 10. 空字符串的長度為_。 11. 在所有函數(shù)定義之外定義的變量,若沒有被初始化則系統(tǒng)隱含對它所賦的初值為_。 12. 若p指向x,則_與x的表示是等價的。 13. 直接訪問表達式(*fp).score所對應(yīng)的間接
5、訪問表達式為_。 三、寫出下列每個程序運行后的輸出結(jié)果(每小題6分,共30分) 1. #include void main() int i,j,k=0; for(i=0; i5; i+) for(j=i; j5; j+) k+; printf(%dn,k); 2. #include void main() int x=20; int i=2; while(ix) if(x%i=0) printf(%d ,i); x/=i; i+; 3. #include void main() int a8=76,63,54,95,40,75,90,66; int i, s=0; for(i=0; i=70
6、& ai=90) s+=ai; printf(s=%dn,s); 4. #include int wf(int x, int y) x=x+y; y+=x; return x+y; void main() int x=3, y=8; printf(%dn,wf(x,y); 5. #include int la(int *a, int n) int i,s=0; for(i=0;in;i+) s+=ai; return s; void main() int a5=1,2,3,4,5; int b=la(a,5)+la(a+2,3); printf(b=%dn,b); 四、寫出下列每個函數(shù)的功能(
7、每小題6分,共12分) 1. int wc(int a, int n, int k) int i, c=0; for(i=0;i=k) c+; return c; 函數(shù)功能: 2. void qa(struct worker a, int n) int i; for(i=0; iscore三、寫出下列每個程序運行后的輸出結(jié)果(每小題6分,共30分)評分標準:根據(jù)答案正確程度酌情給分。 1. 15 2. 2 5 3. s=241 4. 30 5. b=27四、寫出下列每個函數(shù)的功能(每小題6分,共12分)評分標準:根據(jù)答案敘述正確與完整程度酌情給分。 1. 統(tǒng)計并返回一維整型數(shù)組an中大于等于k
8、的值的個數(shù)。 2. 從鍵盤上為具有struct worker類型的數(shù)組an輸入n個記錄。五、按題目要求編寫函數(shù)(每小題6分,共12分)評分標準:根據(jù)函數(shù)編寫的正確與完整程度酌情給分。 1. double mean(double amn,int m,int n) int i,j; double v=0.0; /1分 for(i=0; im; i+) for(j=0; jn; j+) v+=aij; /4分 v/=m*n; return v; /6分 /注:函數(shù)體的最后兩行可以合并為一條返回語句:return v/=m*n 2. int mm(int a,int m) int i,x1,x2; x
9、1=x2=a0; /1分 for(i=1; ix1) x1=ai; /3分 if(aix2) x2=ai; /4分 /5分 return x1-x2; /6分 winger tuivasa-sheck, who scored two tries in the kiwis 20-18 semi-final win over england, has been passed fit after a lower-leg injury, while slater has been named at full-back but is still recovering from a knee injury
10、 aggravated against usa.both sides boast 100% records heading into the encounter but australia have not conceded a try since josh charnleys effort in their first pool match against england on the opening day.aussie winger jarryd hayne is the competitions top try scorer with nine, closely followed by
11、 tuivasa-sheck with eight.but it is recently named rugby league international federation player of the year sonny bill williams who has attracted the most interest in the tournament so far.the kiwi - with a tournament high 17 offloads - has the chance of becoming the first player to win the world cu
12、p in both rugby league and rugby union after triumphing with the all blacks in 2011.id give every award back in a heartbeat just to get across the line this weekend, said williams.the (lack of) air up there watch mcayman islands-based webb, the head of fifas anti-racism taskforce, is in london for t
13、he football associations 150th anniversary celebrations and will attend citys premier league match at chelsea on sunday.i am going to be at the match tomorrow and i have asked to meet yaya toure, he told bbc sport.for me its about how he felt and i would like to speak to him first to find out what h
14、is experience was.uefa hasopened disciplinary proceedings against cskafor the racist behaviour of their fans duringcitys 2-1 win.michel platini, president of european footballs governing body, has also ordered an immediate investigation into the referees actions.cska said they were surprised and dis
15、appointed by toures complaint. in a statement the russian side added: we found no racist insults from fans of cska. baumgartner the disappointing news: mission aborted.the supersonic descent could happen as early as sunda.the weather plays an important role in this mission. starting at the ground, c
16、onditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. the balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. it will climb higher than the tip of mount
17、everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. as he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.the balloon will slowly drift to the edge of s
18、pace at 120,000 feet ( then, i would assume, he will slowly step out onto something resembling an olympic diving platform.they blew it in 2008 when they got caught cold in the final and they will not make the same mistake against the kiwis in manchester.five years ago they cruised through to the fin
19、al and so far history has repeated itself here - the last try they conceded was scored by englands josh charnley in the opening game of the tournament.that could be classed as a weakness, a team under-cooked - but i have been impressed by the kangaroos focus in their games since then.they have been concentrating on the sort of stuff that wins you tough, even contests - strong defence, especially on their own goal-line, completing sets and a good kick-chase. theyve been great at all the unglamorous st
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工廠勞動合同關(guān)鍵條款
- 裝修合同范本簡化版
- 房屋出租簡約合同樣式
- 出租車承包合同
- 線上辦公信息安全協(xié)議
- 旅館承包合同范例
- 房地產(chǎn)經(jīng)紀公司代理合同模板
- 技術(shù)成果轉(zhuǎn)讓股權(quán)協(xié)議
- 2024年汽車租賃合同范本
- 抵押物借款合同的社會責任
- 2024年中國白酒行業(yè)數(shù)字化轉(zhuǎn)型研究報告-36氪-202409
- 胸外科快速康復護理課件
- 外傷急救包扎技術(shù)說課課件
- 清淡的晚餐(課件)六年級上冊勞動北京版
- T-CRHA 046-2024 標準手術(shù)體位安置技術(shù)規(guī)范
- 陽光食品APP培訓考核題庫(含答案)食品生產(chǎn)企業(yè)端
- 中考數(shù)學專題訓練一元二次方程(50道計算題)(無答案)
- 村衛(wèi)生室靜脈輸液規(guī)范和安全管理制度
- 人教版高中化學選擇性必修1第1章化學反應(yīng)的熱效應(yīng)測試含答案
- 超聲技能操作評分表
- 分子篩催化劑的研究進展
評論
0/150
提交評論