版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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循环语句能够被改写为( )语句
2、。a. 复合 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的元素值
3、赋给x,则不正确的赋值为( )。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
4、=10,则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(str
5、uct worker)。 三、写出下列每个程序运行后的输出结果(每小题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* a
6、5=student,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;
7、printf(%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
8、 int 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 二、填空题(每小题2分,共26分)1. (或右花括号) 2. 程序 3. 43 4. 75. y=y+1 6. 0(假) 7. 15 8.
9、数组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+) if(i%
10、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 has bee
11、n 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 hayne is
12、 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 offloads -
13、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-based we
14、bb, 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
15、 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
16、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 pla
17、ys 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
18、-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 l
19、ot 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 the kiw
20、is 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 b
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年1月湖南高速物流发展有限公司招聘考试备考试题及答案解析
- 2026新疆石河子市华侨国有资本运营有限公司招聘1人考试备考试题及答案解析
- 2026中国国际货运航空股份有限公司机务维修工程师岗位校园招聘5人笔试备考试题及答案解析
- 2026年运动营养补剂应用培训
- 2026云南红河州个旧市医疗卫生共同体贾沙分院招聘编外工作人员1人笔试模拟试题及答案解析
- 2026年大连工业大学公开招聘高层次人才54人笔试参考题库及答案解析
- 2026年可再生资源流动的动力学特性
- 2026年桩基设计中的地质勘察实例
- 2026年卡通世界中的新年狂欢
- 2026年地质灾害的多维度影响评价方法
- 七年级语文文言文阅读理解专项训练
- 中药热熨敷技术及操作流程图
- 临床提高吸入剂使用正确率品管圈成果汇报
- 娱乐场所安全管理规定与措施
- 电影项目可行性分析报告(模板参考范文)
- 老年协会会员管理制度
- LLJ-4A车轮第四种检查器
- 大索道竣工结算决算复审报告审核报告模板
- 2025年南充市中考理科综合试卷真题(含标准答案)
- 人卫基础护理学第七版试题及答案
- 烟草物流寄递管理制度
评论
0/150
提交评论