電大1253+C語言程序設(shè)計A(1月)小抄參考_第1頁
電大1253+C語言程序設(shè)計A(1月)小抄參考_第2頁
電大1253+C語言程序設(shè)計A(1月)小抄參考_第3頁
電大1253+C語言程序設(shè)計A(1月)小抄參考_第4頁
電大1253+C語言程序設(shè)計A(1月)小抄參考_第5頁
已閱讀5頁,還剩3頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、試卷代號:1253中央廣播電視大學(xué)2009-2010學(xué)年度第一學(xué)期“開放本科”期末考試c語言程序設(shè)計a試題 一、單選題(每小題2分,共20分)1. c語言源程序文件的缺省擴展名為( )。a. cpp b. exec. obj d. c2設(shè)x和y均為邏輯值,則x & y為真的條件是( )。a. 它們均為真 b. 其中一個為真c. 它們均為假 d. 其中一個為假3. 在下列的符號常量定義中,正確的定義格式為( )。a. #define m1 b. const int m2 20c. #define m3 10 d. const char mark4. for循環(huán)語句能夠被改寫為( )語句。a. 復(fù)

2、合 b. ifc. switch d. while5. 在下面的一維數(shù)組定義中,錯誤的定義格式為( )。a. int a=1,2,3 b. int a10=0c. int a d. int a56下面的函數(shù)原型聲明中存在語法錯誤的是( )。a. aa(int a, int b) b. aa(int, int)c. aa(int a; int b;) d. aa(int a, int)7. 假定a為一個數(shù)組名,則下面存在錯誤的表達式為的( )。a. ai b. *a+c. *a d. *(a+1)8. 假定有定義為“int a10, x, *pa=a;”,若要把數(shù)組a中下標為3的元素值賦給x,則

3、不正確的賦值為( )。a. x=pa3 b. x=*(a+3)c. x=a3 d. x=*pa+39char類型的長度為_個字節(jié)。a. 1 b. 2 c. 3 d. 410. 向一個二進制文件中寫入信息的函數(shù)為( )。a. fgets() b. fputs()c. fread() d. fwrite()二、填空題(每小題2分,共26分)1. c語言中的每條復(fù)合語句以_作為結(jié)束符。2. 在#include命令中所包含的文件,可以是頭文件,也可以是_文件。3. 十進制數(shù)35對應(yīng)的八進制數(shù)為_。4. 假定x=5,則表達式2+x+的值為_。5增量表達式+y表示成賦值表達式為_。6若x=5,y=10,則

4、xy的值為_。7. 假定二維數(shù)組的定義為“int a35;”,則該數(shù)組所含元素的個數(shù)為_。8. 執(zhí)行“typedef int abc10;”語句把abc定義為具有10個整型元素的_類型。9. strcat()函數(shù)用于_兩個字符串。10假定p所指對象的值為25,p+1所指對象的值為46,則*p+的值為_。11. 若要把一個整型指針p轉(zhuǎn)換為字符指針,則采用的強制轉(zhuǎn)換表達式為_。12. null是一個符號常量,通常作為空指針值,它對應(yīng)的值為_。13. 假定要動態(tài)分配一個類型為struct worker的對象,并由r指針指向這個對象,則使用的表達式為 _ =malloc(sizeof(struct w

5、orker)。 三、寫出下列每個程序運行后的輸出結(jié)果(每小題6分,共30分) 1. #include void main() int i,s=0; for(i=1;i6;i+) s+=i*i; printf(“s=%dn”,s); 2. #include #define n 6 void main() int i,an=2,5,8,10,15,21; for(i=0; in; i+) if(ai%5) printf(%d ,ai); printf(n); 3. #include #include void main() int i; unsigned int len; char* a5=stu

6、dent,worker,cadre,soldier,zzeasan123; len=strlen(a0); for(i=1; ilen) len=strlen(ai); printf(%dn,len); 4. #include void main() int a,b; for(a=2,b=3; b20;) printf(%d %d ,a,b); a=a+b; b=a+b; printf(%d %dn,a,b); 5. #include void le(int* a, int* b) int x=*a; *a=*b; *b=x; void main() int x=15, y=26; print

7、f(%d %dn,x,y); le(&x,&y); printf(%d %dn,x,y); 四、寫出下列每個函數(shù)的功能(每小題6分,共12分) 1. #include int sg(int x) /x為大于等于2的整數(shù) int a=(int)sqrt(x); /sqrt(x)取x的平方根 int i=2; while(i=a) if(x%i=0) break; i+; if(idata; f=f-next; while(f) if(f-datax) x=f-data; f=f-next; return x; 假定struct intnode的類型定義為: struct intnode int

8、data; struct intnode* next; 函數(shù)功能: 五、按題目要求編寫程序或函數(shù)(每小題6分,共12分) 1. 編寫一個程序,輸出50以內(nèi)(含50)的、能夠被3或者5整除的所有整數(shù)。 2. 編寫一個遞歸函數(shù)“int ff(int a, int n)”,求出數(shù)組a中所有n個元素之積并返回。參考答案一、單選題(每小題2分,共20分) 1. d 2. a 3. c 4. d 5. c 6. c 7. b 8. d 9. a 10. d 二、填空題(每小題2分,共26分)1. (或右花括號) 2. 程序 3. 43 4. 75. y=y+1 6. 0(假) 7. 15 8. 數(shù)組9.

9、連接 10. 25 11. (char*)p 12. 013. struct worker* r三、寫出下列每個程序運行后的輸出結(jié)果(每小題6分,共30分) 1. s=55 2. 2 8 21 3. 10 4. 2 3 5 8 13 21 5. 15 26 26 15四、寫出下列每個函數(shù)的功能(每小題6分,共12分) 1. 判斷x是否為一個素數(shù),若是則返回1,否則返回0。 2. 求出由f所指向的單鏈表中所有結(jié)點的最大值。 五、按題目要求編寫程序或函數(shù)(每小題6分,共12分) 1. #include void main() int i; for(i=3; i=50; i+) if(i%3=0 |

10、 i%5=0) printf(%d ,i); printf(n); 2. int ff(int a, int n) if(n=0) printf(n值非法n),exit(1); if(n=1) return an-1; else return an-1*ff(a,n-1); 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 nam

11、ed at full-back but is still recovering from a knee injury 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

12、competitions top try scorer with nine, closely followed by 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 t

13、he chance of becoming the first player to win the world cup 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, t

14、he head of fifas anti-racism taskforce, is in london for the 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

15、 and i would like to speak to him first to find out what his 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

16、the referees actions.cska said they were surprised and disappointed 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

17、 important role in this mission. starting at the ground, conditions 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

18、weather lives. it will climb higher than the tip of mount 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

19、 turbulence.the balloon will slowly drift to the edge of space 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

20、 manchester.five years ago they cruised through to the final 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 b

溫馨提示

  • 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論