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

上传人:沈*** 文档编号:41378616 上传时间:2021-11-20 格式:DOC 页数:6 大小:104KB
收藏 版权申诉 举报 下载
电大广播电视大学C++语言程序设计模拟试题小抄参考_第1页
第1页 / 共6页
电大广播电视大学C++语言程序设计模拟试题小抄参考_第2页
第2页 / 共6页
电大广播电视大学C++语言程序设计模拟试题小抄参考_第3页
第3页 / 共6页
资源描述:

《电大广播电视大学C++语言程序设计模拟试题小抄参考》由会员分享,可在线阅读,更多相关《电大广播电视大学C++语言程序设计模拟试题小抄参考(6页珍藏版)》请在装配图网上搜索。

1、专业好文档广播电视大学C+语言程序设计模拟试题2001年元月题 号一二三四五总 分 分 数       评卷人得分  一、填空(每空2分,共20分)  参考答案1.C+源程序文件扩展名为_。2.unsigned long 型数据占_字节存储空间。3.执行语句cout<<"d:datac+test.exe";后,输出结果是_。4.表达式8|3的结果是_。5.全局变量和_若在定义时未进行初始化,则自动初始化为0。6.将s初始化为值是"Hello!"

2、的指针常量,初始化语句是_。7.类中的成员只能为该类的成员函数及该类的派生类中的成员函数访问,则应加上访问属性_。8.定义输出文件流f,并以追加数据方式打开相应文件"a:aaa.dat",定义f的语句是_。9.设文件f.cpp中的一个函数要访问在另一个文件中定义的int型变量x,则在f.cpp中x应定义为_。10.函数模板的说明格式是:template_函数定义。评卷人得分  二、单项选择题(每空2分,共20分)参考答案1.类型修饰符unsigned修饰( )类型是错误的。 A char B int C long int D float2.下列变量名中,

3、( )是合法的。 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;,下列表示引用的方法中,( )是正确的。 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.磁盘文件操作时,在打开磁盘文件的访问方式

4、中,( )是以追加数据 方式打开文件的。 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的类型分别是( )。 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

5、 * 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.设int f1(int n,char * s);char * f2(int n,char * s); 请写出函数指针pf1和pf2的定义,使其分别指向上述两个函数。&

6、#160;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

7、(n);cout<<m<<' '<<n<<endl; m=f2(n);cout<<m<<' '<<n<<endl; 写出结果。 评卷人得分  四、(每题10分,共20分)参考答案1.写出下列程序的执行结果。 # include <iostream.h> 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+; cout&l

8、t;<a<<endl; if(i<j) if(i!=3) if(!k) a=1; else if(k) a=5; a+=2; cout<<a<<endl;  2.设a盘上文本文件aaa.dat中保存有0至100之间的所有奇数,下列程序将全部数据及其和输出至屏幕上,请将程序补充完全。 # include <stdlib.h> # include _ void main(void) _ f1("a:aaa.dat",ios:in|ios:nocreate); if (!f1) cerr<<&quo

9、t;a:aaa.dat file not open!"<<endl; exit(1); int x,s=0; while (_)f1>>x;cout<<x<<' ';_; f1._;  评卷人得分  五、(每题10分,共20分)参考答案1.用while循环编程,求自然数1至100之间各奇数平方和并输出。 2.设有函数void sum(int score 5,int row);,它将数组score每行后四个元素之和用首元素保存。试编写这个函数 编写主函数并初始化相应实参调用这个函数,

10、并输出结果。关闭窗口一、填空(每空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

11、(* pf1)(int n,char * s)=f1;char *( * pf2)(int n,char * s)=f2;     3char * week="Sun","Mon","Tue","Wed","Thu","Fri","Sat"; 4int * p1 ;double * p2;5 5          25 36 6

12、                  25 5四、(每题10分,共20分)返回1 1      6  7        2 fstream.h ifstream !f1.eof() s+=x close()五、(每题10分,共20分)返回1 1  #include<

13、iostream.h>void main()int i=1,sum=0;while(i<=100)sum+=i*i;i+=2;cout<<"sum="<<sum<<endl;                2#include<iostream.h>void sum(int score5,int row)    

14、0;                       for(int i=0;i<row;i+)                  scorei0=0;   

15、   for(int j=1;j<=4;j+)      scorei0+=scoreij;                                 void mai

16、n()                            int a55=0,50,60,70,80,0,51,61,71,81,            0,52,62,72,82,0,53,63

17、,73,83,0,54,64,74,84;            sum(a,5);            for(int i=0;i<5;i+)            cout<<ai0<<endl;

18、0;              "If we don't 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 FA's celebra

19、tions - 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 a nonsense for

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

21、d 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 Fifa's anti-racism taskforce, is in London

22、 for the Football Association's 150th anniversary celebrations and will attend City's 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 it's about how he felt and I would like t

23、o speak to him first to find out what his experience was."Uefa has opened disciplinary proceedings against CSKA for the "racist behaviour of their fans" during City's 2-1 win.Michel Platini, president of European football's governing body, has also ordered an im

24、mediate investigation into the referee's actions.CSKA said they were "surprised and disappointed" by Toure's 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

25、 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 attached, will move through the lower lev

26、el 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 the stratosphere. As he crosses the

27、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 the concrete bottom of a swimming p

28、ool that he wants to land on, but not too hard. Still, he'll 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 so

29、und - 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 stabilization parachute that can

30、 be deployed to slow him down. His team hopes it's 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 (277 kph). He will have a res

31、erve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it won't. 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

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!