电大1253+C语言程序设计A(7月)小抄参考_第1页
电大1253+C语言程序设计A(7月)小抄参考_第2页
电大1253+C语言程序设计A(7月)小抄参考_第3页
电大1253+C语言程序设计A(7月)小抄参考_第4页
电大1253+C语言程序设计A(7月)小抄参考_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

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

文档简介

1、专业好文档试卷代号:1253中央广播电视大学2009-2010学年度第二学期“开放本科”期末考试c语言程序设计a试题2010.7一、单选题(每小题2分,共20分)1在每个c语言程序中都必须包含有这样一个函数,该函数的函数名为( )。a. main b. main c. name d. function2每个c语言程序文件的编译错误分为( )类。a. 1 b. 2 c. 3 d. 43. 字符串a+b=12n的长度为( )。a. 6 b. 7 c. 8 d. 94. 在switch语句的每个case块中,假定都是以break语句结束的,则此switch语句容易被改写为( )语句。a. for b

2、. while c. do d. if5. 在下面的do-while循环语句中,其循环体语句被执行的次数为( )。int i=0; do i+; while(i5)的相反表达式为_。6若x=5,y=10,则x!=y的逻辑值为_。7. 假定二维数组的定义为“int a35;”,则该数组所占存储空间的字节数为_。8. 使用“typedef char bb1050;”语句定义_为含有10行50列的二维字符数组类型。9. 字符串a:xxkfile.txt的长度为_。10假定p所指对象的值为25,p+1所指对象的值为46,则*+p的值为_。11. 假定一个数据对象为int*类型,则指向该对象的指针类型为

3、_。12假定一个结构类型的定义为 “struct aint a,b; a* c;”,则该类型的理论长度为_。13. 假定要访问一个结构对象x中的数据成员a,则表示方式为_。 三、写出下列每个程序运行后的输出结果(每小题6分,共30分) 1. #include void main() int i,j,k=0; for(i=0; i5; i+) for(j=i; j5; j+) k+; printf(%dn,k); 2. #include void main() int x=20; int i=2; while(ix) if(x%i=0) printf(%d ,i); x/=i; i+; 3. #

4、include void main() int a8=70,63,54,95,40,75,90,66; int i, s=0; for(i=0; i=70 & ai=90) s+=ai; printf(s=%dn,s); 4. #include int wf(int x, int y) x=x+y; y+=x; return x+y; void main() int x=3, y=5; printf(%dn,wf(x,y); 5. #include int la(int *a, int n) int i,s=0; for(i=0;in;i+) s+=ai; return s; void mai

5、n() int a5=1,2,3,4,5; int b=la(a,5)+la(a+1,3); printf(b=%dn,b); 四、写出下列每个函数的功能(每小题6分,共12分) 1. int sg(int x) /x为大于等于2的整数 int i=2; if(x=2 | x=3) return 1; while(i*i=x) if(x%i=0) break; i+; if(i*idata; f=f-next; while(f) if(f-datax) x=f-data; f=f-next; return x; 假定struct intnode的结点类型定义为: struct intnode

6、int data; struct intnode* next; 函数功能: 五、按照题目要求编写程序或函数(每小题6分,共12分) 1. 编写一个主函数,计算1+3+32+.+310的值并输出,假定分别用i,p,s作为循环变量、累乘变量和累加变量的标识符。 2. 根据函数原型“int ff(int a, int n)”,编写函数定义,计算并返回数组an中所有元素之和。参考答案一、单选题(每小题2分,共20分)1. a 2. b 3. b 4. d 5. c6. c 7. a 8. c 9. a 10. b二、填空题(每小题2分,共26分)1. c 2. 2 3. float 4. 335. (

7、x!=0 | y=5) 或:(x | y=5) 6. 1(真,true)7. 60 8. bb 9. 15 10. 4611. int* 12. 12 13. x.a三、写出下列每个程序运行后的输出结果(每小题6分,共30分)1. 152. 2 53. s=2354. 215. b=24四、写出下列每个函数的功能(每小题6分,共12分)1. 判断x是否为一个素数,若是则返回1,否则返回0。2. 求出并返回由f所指向的单链表中所有结点的最大值。五、按照题目要求编写程序或函数(每小题6分,共12分)1. #include void main() int i; int p=1; int s=1; f

8、or(i=1;i=10;i+) p*=3; s+=p; printf(%dn,s); 2. int ff(int a, int n) int i,sum=0; for(i=0; in; i+) sum+=ai; return sum; winger tuivasa-sheck, who scored two tries in the kiwis 20-18 semi-final win over england, has been passed fit after a lower-leg injury, while slater has been named at full-back but

9、is still recovering from a knee injury aggravated against usa.both sides boast 100% records heading into the encounter but australia have not conceded a try since josh charnleys effort in their first pool match against england on the opening day.aussie winger jarryd hayne is the competitions top try

10、 scorer with nine, closely followed by tuivasa-sheck with eight.but it is recently named rugby league international federation player of the year sonny bill williams who has attracted the most interest in the tournament so far.the kiwi - with a tournament high 17 offloads - has the chance of becomin

11、g the first player to win the world cup in both rugby league and rugby union after triumphing with the all blacks in 2011.id give every award back in a heartbeat just to get across the line this weekend, said williams.the (lack of) air up there watch mcayman islands-based webb, the head of fifas ant

12、i-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

13、 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

14、.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 t

15、his 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 wi

16、ll 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 ball

17、oon 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.they blew it in 2008 when they got caught cold in the final and they will not make the same mistake against the kiwis in manchester.five yea

18、rs ago they cruised through to the final and so far history has repeated itself here - the last try they conceded was scored by englands josh charnley in the opening game of the tournament.that could be classed as a weakness, a team under-cooked - but i have been impressed by the kangaroos focus in their games since then.they have been concentrating on the sort of stuff that wins you tough, even contests - strong defence, especially on their own goal-line, completing sets and a good kick-chase. theyve been great at all the unglamorous stuff that often goes unnoticed in the

温馨提示

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

评论

0/150

提交评论