电大C++考试题及答案小抄参考.doc

上传人:仙人指路1688 文档编号:2198477 上传时间:2023-01-29 格式:DOC 页数:5 大小:122.01KB
返回 下载 相关 举报
电大C++考试题及答案小抄参考.doc_第1页
第1页 / 共5页
电大C++考试题及答案小抄参考.doc_第2页
第2页 / 共5页
电大C++考试题及答案小抄参考.doc_第3页
第3页 / 共5页
电大C++考试题及答案小抄参考.doc_第4页
第4页 / 共5页
电大C++考试题及答案小抄参考.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《电大C++考试题及答案小抄参考.doc》由会员分享,可在线阅读,更多相关《电大C++考试题及答案小抄参考.doc(5页珍藏版)》请在三一办公上搜索。

1、专业好文档广播电视大学C+语言程序设计期末考试试题2001年元月一、填空(每空2分,共20分)1 C+目标程序经_连接_后生成扩展名为exe的可执行程序文件。2 16位计算机中整型占_2_个字节存储空间。3 要在屏幕上显示Hello,world!应执行语句cout=0|x=0) coutabcd;else coutwxyz;屏幕上显示的是abcd 。7 设一维整型数组data已进行了初始化,则其元素个数可由操作符sizeof通过表达式sizeof(data/data0)_计算出来。8 若一全局变量只允许本程序文件中的函数使用,则定义它时应加上修饰符_Static。9 设有int w34;,pw

2、是与数组名w等价的数组指针,则pw应初始化为_ int (* pw)4=w。10.要使引用pr代表变量char * p;,则pr应初始化为char * &pr=p。二、单项选择题(每空2分,共20分)1下列变量名中,(A )是合法的。A CHINA B byte-size C double D A+a2下列各种函数中,(C )不是类的成员函数。 A 构造函数 B 析构函数 C 友元函数 D 拷贝构造函数3下列( A )是正确的语句。 A ; B a=17 C x+y D coutn4循环while(int i=0) i-;执行次数是( A )。 A 0 B 1 C 5 D 无限5设int f(

3、int);和int g(int);是函数f和g的原形,以下将f作为语句调用的是( B )。A g(f(3);B f(g(3); C g(f(3)+2); D p= f(g(3)1);6设int * p2=&x,* p1=a;p2= *b;则a和b的类型分别是( B )。 A int * 和int B int * 和int * C int 和int * D int * 和int *7设int x;,则经过( 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设void f1(int * m,long & n);int a;long b;则以下调用合法的是( B )。 A f1(a,b); B f1(&a,b); C f1(a,&b); D f1(&a,&b);9以下结构类型可用来构造链表的是( 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对数据进行格式输出时,需要包含( C iomanip.h C )文件。 三、回答问题(每题4分,共20分)1设in

5、t * p;,判断下列表达式的正确性(用T表正确,用F表错误)。 -+p( T ) +(p-)( F ) p- ( F ) (+p)- ( T )2请初始化一维指针数组color,其初值表初值为red,blue,white和black。char * color=red,blue,white,black3设int x 99,98,97,& y=x1;, 写出语句 couty-,; couty*2endl;执行结果。 98,1944设int fp(char a,int b=0,double c=100.0);,判断下列重载函数的正确性。(用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;能正常执行,写出p1和p2的定义。long * p1; float * p2;四、(每题10分,共20分)1写出下列程序的执行结果。 # 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间的整数,请将程序补充完全。 # 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 编程求数列1,的所有大于等于0.000001的数据项之和并输出结果。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用递归方法设计函数int ArrayMin (int d ,int size);,其中d为数组,size为数组元素个数;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 ex

19、pected 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 a s

20、tabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will have to slow to 172 mph (27

21、7 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).cause there

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 教育教学 > 成人教育


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号