




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、试卷代号:1253中央广播电视大学2009-2010学年度第一学期“开放本科”期末考试c语言程序设计a试题 一、单选题(每小题2分,共20分)1. c语言源程序文件的缺省扩展名为( )。a. cpp b. exec. obj d. c2设x和y均为逻辑值,则x & y为真的条件是( )。a. 它们均为真 b. 其中一个为真c. 它们均为假 d. 其中一个为假3. 在下列的符号常量定义中,正确的定义格式为( )。a. #define m1 b. const int m2 20c. #define m3 10 d. const char mark4. for循环语句能够被改写为( )语句。a. 复
2、合 b. ifc. switch d. while5. 在下面的一维数组定义中,错误的定义格式为( )。a. int a=1,2,3 b. int a10=0c. int a d. int a56下面的函数原型声明中存在语法错误的是( )。a. aa(int a, int b) b. aa(int, int)c. aa(int a; int b;) d. aa(int a, int)7. 假定a为一个数组名,则下面存在错误的表达式为的( )。a. ai b. *a+c. *a d. *(a+1)8. 假定有定义为“int a10, x, *pa=a;”,若要把数组a中下标为3的元素值赋给x,则
3、不正确的赋值为( )。a. x=pa3 b. x=*(a+3)c. x=a3 d. x=*pa+39char类型的长度为_个字节。a. 1 b. 2 c. 3 d. 410. 向一个二进制文件中写入信息的函数为( )。a. fgets() b. fputs()c. fread() d. fwrite()二、填空题(每小题2分,共26分)1. c语言中的每条复合语句以_作为结束符。2. 在#include命令中所包含的文件,可以是头文件,也可以是_文件。3. 十进制数35对应的八进制数为_。4. 假定x=5,则表达式2+x+的值为_。5增量表达式+y表示成赋值表达式为_。6若x=5,y=10,则
4、xy的值为_。7. 假定二维数组的定义为“int a35;”,则该数组所含元素的个数为_。8. 执行“typedef int abc10;”语句把abc定义为具有10个整型元素的_类型。9. strcat()函数用于_两个字符串。10假定p所指对象的值为25,p+1所指对象的值为46,则*p+的值为_。11. 若要把一个整型指针p转换为字符指针,则采用的强制转换表达式为_。12. null是一个符号常量,通常作为空指针值,它对应的值为_。13. 假定要动态分配一个类型为struct worker的对象,并由r指针指向这个对象,则使用的表达式为 _ =malloc(sizeof(struct w
5、orker)。 三、写出下列每个程序运行后的输出结果(每小题6分,共30分) 1. #include void main() int i,s=0; for(i=1;i6;i+) s+=i*i; printf(“s=%dn”,s); 2. #include #define n 6 void main() int i,an=2,5,8,10,15,21; for(i=0; in; i+) if(ai%5) printf(%d ,ai); printf(n); 3. #include #include void main() int i; unsigned int len; char* a5=stu
6、dent,worker,cadre,soldier,zzeasan123; len=strlen(a0); for(i=1; ilen) len=strlen(ai); printf(%dn,len); 4. #include void main() int a,b; for(a=2,b=3; b20;) printf(%d %d ,a,b); a=a+b; b=a+b; printf(%d %dn,a,b); 5. #include void le(int* a, int* b) int x=*a; *a=*b; *b=x; void main() int x=15, y=26; print
7、f(%d %dn,x,y); le(&x,&y); printf(%d %dn,x,y); 四、写出下列每个函数的功能(每小题6分,共12分) 1. #include int sg(int x) /x为大于等于2的整数 int a=(int)sqrt(x); /sqrt(x)取x的平方根 int i=2; while(i=a) if(x%i=0) break; i+; if(idata; f=f-next; while(f) if(f-datax) x=f-data; f=f-next; return x; 假定struct intnode的类型定义为: struct intnode int
8、data; struct intnode* next; 函数功能: 五、按题目要求编写程序或函数(每小题6分,共12分) 1. 编写一个程序,输出50以内(含50)的、能够被3或者5整除的所有整数。 2. 编写一个递归函数“int ff(int a, int n)”,求出数组a中所有n个元素之积并返回。参考答案一、单选题(每小题2分,共20分) 1. d 2. a 3. c 4. d 5. c 6. c 7. b 8. d 9. a 10. d 待添加的隐藏文字内容1二、填空题(每小题2分,共26分)1. (或右花括号) 2. 程序 3. 43 4. 75. y=y+1 6. 0(假) 7.
9、15 8. 数组9. 连接 10. 25 11. (char*)p 12. 013. struct worker* r三、写出下列每个程序运行后的输出结果(每小题6分,共30分) 1. s=55 2. 2 8 21 3. 10 4. 2 3 5 8 13 21 5. 15 26 26 15四、写出下列每个函数的功能(每小题6分,共12分) 1. 判断x是否为一个素数,若是则返回1,否则返回0。 2. 求出由f所指向的单链表中所有结点的最大值。 五、按题目要求编写程序或函数(每小题6分,共12分) 1. #include void main() int i; for(i=3; i=50; i+)
10、 if(i%3=0 | i%5=0) printf(%d ,i); printf(n); 2. int ff(int a, int n) if(n=0) printf(n值非法n),exit(1); if(n=1) return an-1; else return an-1*ff(a,n-1); 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 h
11、as been named at full-back but 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 ha
12、yne is the competitions top try 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 offlo
13、ads - has the chance of becoming 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-ba
14、sed 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
15、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 investig
16、ation 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 weath
17、er 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
18、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 expe
19、ct 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.they blew it in 2008 when they got caught cold in the final and they will not make the same mistake against t
20、he kiwis in manchester.five years 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
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025合同中的‘隐秘风险’
- 2025年稀有金属及稀土金属材料项目建议书
- 2025标准工业仓库租赁合同范本
- 2025中国某省份教育行业教师之总集体合同范本
- 2025合作连锁加盟合同范本
- 2025年敏感元件及传感器项目建议书
- 2025年泌尿系统感染用药项目合作计划书
- 2025年软件开发、评测平台合作协议书
- 2025年农林牧渔专用仪器仪表项目建议书
- 2025年模组检测系统合作协议书
- VDA6-3的要求与说明
- 桩水平承载力计算
- GB 43067-2023煤矿用仪器仪表安全技术要求
- 大课间跑操评分表
- 教育调查报告3000字小学
- 沟通的艺术沟通与自我课件
- 资产管理公司不良资产处置咨询服务协议
- 工程质量管理体系和质量管理制度
- 学生休学家长申请表
- 数独题目100题1(可打印)
- 2020年度高等学校科学研究优秀成果奖(科学技术)
评论
0/150
提交评论