




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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每行后四个元素之和用首元素保存。试编写这个函数 编写主函数并初始化相应实参调用这个函数,并输出结果。关闭窗口一、填空(每空2分,共20分) 返回1.cpp2.43.
8、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; 3char * week=sun,mon,tue,wed,th
9、u,fri,sat; 4int * p1 ;double * p2;5 5 25 36 6 25 5四、(每题10分,共20分)返回1 1 672 fstream.h ifstream !f1.eof() s+=x close()五、(每题10分,共20分)返回1 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;for(int j=1;j=4;j+)scor
10、ei0+=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 after fifa vice-president jeffrey webb - a
11、lso 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 decided by the fifa congress that it is
12、 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 can do something better to fight racism
13、 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 taskforce, is in london for the footb
14、all 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 his exper
15、ience 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 disappointe
16、d 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, conditions
17、 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 everest (
18、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 space at 1
19、20,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 the distance, it will not be like div
20、ing 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 goe
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 二零二五年度二手房买卖合同下载:房屋交易流程
- 二零二五年度a轮融资协议范本解析
- 2025版智能家居与安防一体化个人住宅装修合同
- 2025版电视产品定制开发合同范本
- 2025版厂房装修工程劳务分包合同协议书
- 2025版煤矿承包合作开发合同样本
- 二零二五年度消防设施维保服务补充协议范本
- 2025版搬家物流运输合同参考范本
- 二零二五年度房地产项目合作开发与建筑垃圾处理协议
- 二零二五年度绿色建筑房屋买卖中介服务合同
- 河北农业大学分子生物学题库(带答案)
- AI办公效率提升讲座
- 2025四川建筑安全员-C证考试(专职安全员)题库及答案
- 沐足行业严禁黄赌毒承诺书
- 张志伟-德国古典哲学选读-费希特和谢林
- DB51-T 2968-2022 经济开发区安全风险评估导则
- 饮料制造企业环境管理制度要求
- 医学影像学课件
- 广东省惠州市2024-2025学年上学期期中考试七年级数学试卷
- 北师版九年级数学 第四章 图形的相似 知识归纳与题型突破(十一类题型清单)
- 六年级数学上册第二单元《位置与方向》测试题-人教版(含答案)
评论
0/150
提交评论