电大中央广播电视大学C++试题小抄参考

上传人:仙*** 文档编号:30010965 上传时间:2021-10-09 格式:DOC 页数:7 大小:134.12KB
返回 下载 相关 举报
电大中央广播电视大学C++试题小抄参考_第1页
第1页 / 共7页
电大中央广播电视大学C++试题小抄参考_第2页
第2页 / 共7页
电大中央广播电视大学C++试题小抄参考_第3页
第3页 / 共7页
点击查看更多>>
资源描述
专业好文档附件:中央广播电视大学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(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;”,则该数组所含元素的个数为_。 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() 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 age; /年龄 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; 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. DataType 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分)评分标准:根据编程的完整情况酌情给分。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 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 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 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 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 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, 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 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 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/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 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 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 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 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 (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
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档


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

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


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