电大广播电视大学C++语言程序设计模拟试题参考答案小抄参考.doc

上传人:文库蛋蛋多 文档编号:2199730 上传时间:2023-01-29 格式:DOC 页数:7 大小:133.01KB
返回 下载 相关 举报
电大广播电视大学C++语言程序设计模拟试题参考答案小抄参考.doc_第1页
第1页 / 共7页
电大广播电视大学C++语言程序设计模拟试题参考答案小抄参考.doc_第2页
第2页 / 共7页
电大广播电视大学C++语言程序设计模拟试题参考答案小抄参考.doc_第3页
第3页 / 共7页
电大广播电视大学C++语言程序设计模拟试题参考答案小抄参考.doc_第4页
第4页 / 共7页
电大广播电视大学C++语言程序设计模拟试题参考答案小抄参考.doc_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《电大广播电视大学C++语言程序设计模拟试题参考答案小抄参考.doc》由会员分享,可在线阅读,更多相关《电大广播电视大学C++语言程序设计模拟试题参考答案小抄参考.doc(7页珍藏版)》请在三一办公上搜索。

1、专业好文档广播电视大学C+语言程序设计模拟试题2001年元月题 号一二三四五总 分分 数评卷人得分 一、填空(每空2分,共20分) 参考答案1.C+源程序文件扩展名为_。2.unsigned long 型数据占_字节存储空间。3.执行语句coutd:datac+test.exe;后,输出结果是_。4.表达式8|3的结果是_。5.全局变量和_若在定义时未进行初始化,则自动初始化为0。6.将s初始化为值是Hello!的指针常量,初始化语句是_。7.类中的成员只能为该类的成员函数及该类的派生类中的成员函数访问,则应加上访问属性_。8.定义输出文件流f,并以追加数据方式打开相应文件a:aaa.dat,

2、定义f的语句是_。9.设文件f.cpp中的一个函数要访问在另一个文件中定义的int型变量x,则在f.cpp中x应定义为_。10.函数模板的说明格式是:template_函数定义。评卷人得分二、单项选择题(每空2分,共20分)参考答案1.类型修饰符unsigned修饰( )类型是错误的。 A char B int C long int D float2.下列变量名中,( )是合法的。 A _var B bye-bye C int D 123_cc3.设int a=3,* p=&a;,则*p的值是( )。 A 变量a的地址值 B 无意义 C 变量p的地址值 D 34.设int m=0;,下列表示引

3、用的方法中,( )是正确的。 A int &x=m; B int &y=10; C int &z; D float &t=&m5.循环for(int i=0,x=0;!x&i=5;i+);的循环体执行次数是( )。 A 5 B 6 C 1 D 无限 6.磁盘文件操作时,在打开磁盘文件的访问方式中,( )是以追加数据 方式打开文件的。 A in B out C app D ate7.类X中,若没有定义构造函数,则默认的构造函数是( )。 A X ( ) B X (X & x) *this=x; C X ( ) D 不存在8.设int * p2=&x,* p1=a;*p2=*b;则变量a和b的类型

4、分别是( )。 A int和int B int * 和int C int和int * D int * 和int *9.设p为指针变量,则以下表达式正确的是( )。 A -p+ B -+p C -(p+5) D (p-5)+ 10.设void f1(int &x,char * p);int m;char s =c+;以下调用合法的是( )。 A f1(&m,&s); B f1(&m,s); C f1(m,s); D f1(m,&s);评卷人得分三、回答问题(每题4分,共20分)参考答案1.设int a34;double b345; 请写出数组指针pa和pb的定义,使其分别与数组名a和b等价。2.

5、设int f1(int n,char * s);char * f2(int n,char * s); 请写出函数指针pf1和pf2的定义,使其分别指向上述两个函数。3.请初始化一维指针数组week。其初值表初值为Sun,Mon,Tue,Wed,Thu,Fri和Sat。 4.要使语句p1=new int(10) ;p2=new double 10;能正常执行,写出p1和p2的定义。 5.设有int f1(int n)n+=2;return n*n; int f2(int &n)n+=2;return n*n; 执行 int m=5,n=3; m=f1(n);coutm nendl; m=f2(n

6、);coutm nendl; 写出结果。评卷人得分四、(每题10分,共20分)参考答案1.写出下列程序的执行结果。 # include void main() int i=1,j=2,k=3,a=10; if (!i) a-; else if(j) if(k) a=5; else a=6; a+; coutaendl; if(ij) if(i!=3) if(!k) a=1; else if(k) a=5; a+=2; coutaendl; 2.设a盘上文本文件aaa.dat中保存有0至100之间的所有奇数,下列程序将全部数据及其和输出至屏幕上,请将程序补充完全。 # include # inc

7、lude _ void main(void) _ f1(a:aaa.dat,ios:in|ios:nocreate); if (!f1) cerra:aaa.dat file not open!x;coutx ;_; f1._; 评卷人得分五、(每题10分,共20分)参考答案1.用while循环编程,求自然数1至100之间各奇数平方和并输出。2.设有函数void sum(int score 5,int row);,它将数组score每行后四个元素之和用首元素保存。试编写这个函数 编写主函数并初始化相应实参调用这个函数,并输出结果。关闭窗口广播电视大学C+语言程序设计模拟试题答案2001年元月一

8、、填空(每空2分,共20分) 返回1.cpp2.43.d:datac+test.exe4.115.静态局部变6.char * const s=Hello!;7.protected8.ofstream f(a:aaa.dat,ios:app);9.extern int x;10.二、单项选择题(每空2分,共20分)返回1D2A3D4A5B6C7A8D9B10C三、回答问题(每题4分,共20分)返回1int (*pa)4=a;double(*pb)45=b;2int (* pf1)(int n,char * s)=f1;char *( * pf2)(int n,char * s)=f2; 3cha

9、r * week=Sun,Mon,Tue,Wed,Thu,Fri,Sat; 4int * p1 ;double * p2;5 25 36 25 5四、(每题10分,共20分)返回1 6 7 2 fstream.h ifstream !f1.eof() s+=x close()五、(每题10分,共20分)返回1 #includevoid main()int i=1,sum=0;while(i=100)sum+=i*i;i+=2;coutsum=sumendl; 2#includevoid sum(int score5,int row) for(int i=0;irow;i+) scorei0=0

10、; for(int j=1;j=4;j+) scorei0+=scoreij; void main() int a55=0,50,60,70,80,0,51,61,71,81, 0,52,62,72,82,0,53,63,73,83,0,54,64,74,84; sum(a,5); for(int i=0;i5;i+) coutai0endl; 关闭窗口 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 afte

11、r 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 director Roman Babaev says the matter has been exaggerated by the Ivorian and the British media.Blatter, 77, said: It has been d

12、ecided 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 played without spectators because it is against the spirit of football and against the visiting team. It is all nonsense.We c

13、an 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 discrimination can be washed out of football.The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifas anti-racism

14、 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 and I would like to speak t

15、o 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 the referees actions.CSKA sa

16、id 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 important role in this missi

17、on. 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 weather lives. It will climb

18、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 turbulence.The balloon will

19、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 the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite

20、 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 wil

21、l 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 stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his

22、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 (277 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号