電大C++考試題及答案小抄參考_第1頁
電大C++考試題及答案小抄參考_第2頁
電大C++考試題及答案小抄參考_第3頁
電大C++考試題及答案小抄參考_第4頁
免費預(yù)覽已結(jié)束,剩余1頁可下載查看

下載本文檔

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

文檔簡介

1、專業(yè)好文檔廣播電視大學(xué)c+語言程序設(shè)計期末考試試題2001年元月一、填空(每空2分,共20分)1 c+目標(biāo)程序經(jīng)_連接_后生成擴展名為exe的可執(zhí)行程序文件。2 16位計算機中整型占_2_個字節(jié)存儲空間。3 要在屏幕上顯示hello,world!應(yīng)執(zhí)行語句cout=0|x=0) coutabcd;else coutwxyz;屏幕上顯示的是abcd 。7 設(shè)一維整型數(shù)組data已進行了初始化,則其元素個數(shù)可由操作符sizeof通過表達式sizeof(data/data0)_計算出來。8 若一全局變量只允許本程序文件中的函數(shù)使用,則定義它時應(yīng)加上修飾符_static。9 設(shè)有int w34;,pw

2、是與數(shù)組名w等價的數(shù)組指針,則pw應(yīng)初始化為_ int (* pw)4=w。10.要使引用pr代表變量char * p;,則pr應(yīng)初始化為char * &pr=p。二、單項選擇題(每空2分,共20分)1下列變量名中,(a )是合法的。a china b byte-size c double d a+a2下列各種函數(shù)中,(c )不是類的成員函數(shù)。 a 構(gòu)造函數(shù) b 析構(gòu)函數(shù) c 友元函數(shù) d 拷貝構(gòu)造函數(shù)3下列( a )是正確的語句。 a ; b a=17 c x+y d coutn4循環(huán)while(int i=0) i-;執(zhí)行次數(shù)是( a )。 a 0 b 1 c 5 d 無限5設(shè)int f(

3、int);和int g(int);是函數(shù)f和g的原形,以下將f作為語句調(diào)用的是( b )。a g(f(3);b f(g(3); c g(f(3)+2); d p= f(g(3)1);6設(shè)int * p2=&x,* p1=a;p2= *b;則a和b的類型分別是( b )。 a int * 和int b int * 和int * c int 和int * d int * 和int *7設(shè)int x;,則經(jīng)過( c )后,語句*px=0;可將x值置為0。 a int * px; b int const * px=&x; c int * const px=&x; d const int * px=&x

4、;8設(shè)void f1(int * m,long & n);int a;long b;則以下調(diào)用合法的是( b )。 a f1(a,b); b f1(&a,b); c f1(a,&b); d f1(&a,&b);9以下結(jié)構(gòu)類型可用來構(gòu)造鏈表的是( b )。 a struct aa int a;int * b; b struct bb int a;bb * b; c struct cc int * a;cc b; d struct dd int * a;aa b;10使用操作符setw對數(shù)據(jù)進行格式輸出時,需要包含( c iomanip.h c )文件。 三、回答問題(每題4分,共20分)1設(shè)in

5、t * p;,判斷下列表達式的正確性(用t表正確,用f表錯誤)。 -+p( t ) +(p-)( f ) p- ( f ) (+p)- ( t )2請初始化一維指針數(shù)組color,其初值表初值為red,blue,white和black。char * color=red,blue,white,black3設(shè)int x 99,98,97,& y=x1;, 寫出語句 couty-,; couty*2endl;執(zhí)行結(jié)果。 98,1944設(shè)int fp(char a,int b=0,double c=100.0);,判斷下列重載函數(shù)的正確性。(用t表正確,用f表錯誤)。int fp( );( t ) v

6、oid fp(char);( f ) int fp(char,int);( f ) void fp(char,int,int);( t )5要使語句p1=new long * ;p2=new float * 15;能正常執(zhí)行,寫出p1和p2的定義。long * p1; float * p2;四、(每題10分,共20分)1寫出下列程序的執(zhí)行結(jié)果。 # include void fun(int,int,int * ); void main() int x,y,z; fun (2,3,&x); fun (4,x,&y); fun (x,y,&z); coutx,y,zendl; void fun(i

7、nt a,int b,int * c ) b*=a;*c=b-a; 4,12,442下列程序向a盤上的文本文件aaa.dat輸出0至100間的整數(shù),請將程序補充完全。 # include # include _ void main(void) ofstream f1(void main() ); if (_!f1(或f1.fail()_) cerra:aaa.dat file not open!endl; exit(1); for (int i=0;i=100;i+)_ f1_i ; f1. close()_; 五、1 編程求數(shù)列1,的所有大于等于0.000001的數(shù)據(jù)項之和并輸出結(jié)果。1、#

8、include void main()int n=1,d=1;double s=0.0,s0;while(s0=double(n)/d)=0.000001)s+=s0;d+; coutsendl;2用遞歸方法設(shè)計函數(shù)int arraymin (int d ,int size);,其中d為數(shù)組,size為數(shù)組元素個數(shù);arraymin返回d中的最小元素。2int arraymin(int d,int size)int k=dsize-1;if(size=1) return k;if(k=arraymin(d,size-1) return k;else return arraymin(d,size

9、-1);if we dont do that it will go on and go on. we have to stop it; we need the courage to do it.his comments came hours after fifa vice-president jeffrey webb - also in london for the fas celebrations - said he wanted to meet ivory coast international toure to discuss his complaint.cska general dir

10、ector roman babaev says the matter has been exaggerated by the ivorian and the british media.blatter, 77, said: it has been decided by the fifa congress that it is a nonsense for racism to be dealt with with fines. you can always find money from somebody to pay them.it is a nonsense to have matches

11、played without spectators because it is against the spirit of football and against the visiting team. it is all nonsense.we can do something better to fight racism and discrimination.this is one of the villains we have today in our game. but it is only with harsh sanctions that racism and discrimina

12、tion can be washed out of football.the (lack of) air up there watch mcayman islands-based webb, the 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 m

13、atch 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 his experience was.uefa hasopened disciplinary proceedings against cskafor the racist behaviour of their fans duringcitys 2-1 win.michel platini,

14、president of european footballs governing body, has also ordered an immediate investigation into 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

15、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, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. the balloon, with capsule attac

16、hed, 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 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

17、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 space at 120,000 feet ( then, i would assume, he will slowly step out onto something resembling an olympic diving platform.below, the earth becomes

18、 the concrete bottom of a swimming pool that he wants to land on, but not too hard. still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. it will be like he is diving into the shallow end.skydiver preps for the big jumpwhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to earth. but this will not be enough to stop him completely.if he goes too fast or spins out of control, he has

溫馨提示

  • 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)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論