电大中央广播电视大学C++试题小抄参考_第1页
电大中央广播电视大学C++试题小抄参考_第2页
电大中央广播电视大学C++试题小抄参考_第3页
电大中央广播电视大学C++试题小抄参考_第4页
电大中央广播电视大学C++试题小抄参考_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、专业好文档附件:中央广播电视大学2007秋c+语言程序设计课程试卷(6)题 号一二三四五总 分得 分2010年7月考 一、单选题(每小题2分,共20分) 1. c+可执行文件的默认扩展名为( b )。 a. cpp b. exe c. obj d. lik 2. 程序运行中需要从键盘上输入多于一个数据时,各数据之间应使用( d )符号作为分隔符。 a. 空格或逗号 b. 逗号或回车 c. 逗号或分号 d. 空格或回车 3在每个c+程序中都必须包含有这样一个函数,该函数的函数名为( a )。 a. main b. main c. name d. function 4. 假定一个循环语句为“for

2、(int i=0; iy & x!=10的相反表达式为_。 4. 每个字符指针变量占用内存的_个字节的存储空间。 5. 执行“typedef int datatype;”语句后,在使用int定义整型变量的地方都可以使用标识符_来定义整型变量。 6. 对于在所有函数定义之外定义的变量,若没有被初始化则系统隐含对它赋予的初值为_。 7假定p所指对象的值为25,p+1所指对象的值为46,则执行“*(p+1);”语句后,p所指对象的值为_。 8假定一个结构类型的定义为“struct aint a; double* b; a* c;”,则该类型的大小为_字节。 9假定一维数组的定义为“int a8;”,

3、则该数组所含元素的个数为_。 10. 若while循环语句的头部为”while(i+=10)”,若i的初值为0,同时在循环体中不会修改i的值,则其循环体将被重复执行_次后正常结束。 三、写出下列每个程序运行后的输出结果(每小题6分,共30分) 1. #include void main() int s=0; for(int i=1;i=8;i+=2) s+=i*i; couts=sendl; 输出结果: 2. #include void main() int i=1,s=0; while(s15) s+=i+; couti,sendl; 输出结果: 3. #include void main(

4、) int a8=36,25,48,14,55,20,47,82; int c1=0, c2=0; for(int i=0; i8; i+) if(ai50) c1+; else c2+; coutc1 c2endl; 输出结果: 4. #include int lb(int *a, int n) int p=1; for(int i=0;in;i+) p*=*a; a+; return p; void main() int a5=1,2,3,4,3; coutlb(a,5)endl; 输出结果: 5. #include struct worker char name15; /姓名 int a

5、ge; /年龄 float pay; /工资 ; void main() worker x=wangfong,46,1640; worker y, *p; y=x; p=&x; couty.age+10 pay*2x; y+=x*x; while(-n); return y; 函数功能: 2. bool we(int a, int b, int n) for(int i=0;in;i+) if(ai!=bi) break; if(i=n) return true; return false; 函数功能: 3. int lk(int a, int n) double s=0; int i,m=0

6、; for(i=0;in;i+) s+=ai; s=s/n; for(i=0;i=s) m+; return m; 函数功能: 五、按题目要求编写函数(6分) 假定一个函数声明为“int ff(int a, int n);”,要求递归求出数组a中所有n个元素之积并返回。中央广播电视大学2007秋c+语言程序设计课程试卷答案及评分标准(6)(供参考)一、单选题(每小题2分,共20分)1b 2. d 3a 4. c 5c 6. a 7. a 8. b 9b 10a 二、填空题(每小题2分,共20分)1. const 2. 2*pow(x,5)3. x=y | x=10 4. 45. datatyp

7、e 6. 07. 25 8. 129. 8 10. 11三、写出下列每个程序运行后的输出结果(每小题6分,共30分)1. s=842. 6,15 /每个数据3分3. 6 2 /每个数据3分4. 72 /6分5. 56 3280 /每个数据3分四、写出下列每个函数的功能(每小题8分,共24分)评分标准:每题与参考答案的叙述含义相同者得8分,否则酌情给分。1.求出从键盘上输入的n个整数的平方和并返回。2. 判断具有n个元素的两个数组a和b中对应元素值是否全部相等,若是则返回真,否则返回假。3.统计出数组an中大于等于其平均值的元素个数并作为函数值返回。五、按题目要求编写函数(6分)评分标准:根据编

8、程的完整情况酌情给分。int ff(int a, int n) if(n=1) return an-1; else return an-1*ff(a,n-1); /或者if(n=0) return 1; / else return an-1*ff(a,n-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 lon

9、don 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 a nonsens

10、e 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 and discr

11、imination.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 football associ

12、ations 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 experience was.

13、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 disappointed by toure

14、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 descent could happen as early as sunda.the weather plays an important role in this mission. starting at the ground, conditions have to b

15、e 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 (5.5 miles/

16、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 120,000 fee

17、t ( 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 diving into t

18、he 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 a stabilization pa

温馨提示

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

评论

0/150

提交评论