电大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页,还剩3页未读 继续免费阅读

下载本文档

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

文档简介

1、c语言程序设计a课程试卷(6)题 号一二三四五总 分得 分2011年7月考 一、单选题(每小题2分,共20分) 1. c语言程序中的基本功能模块为( )。 a. 表达式 b. 标识符 c. 语句 d. 函数 2. 逻辑表达式(x0 | y=5)的相反表达式为( )。a. x=0 | y!=5 b. x0 | y!=5 d. x0 & y=5 3. 循环体至少被执行一次的循环语句为( )。 a. for b. while c. do-while d. 任一种循环 4. 假定n的值为5,则表达式n+的值为( )。 a. 6 b. 5 c. 4 d. 7 5. 假定一个二维数组的定义为“int a3

2、4=3,4,2,8,6;”,则元素a20的值为( )。 a. 0 b. 2 c. 4 d. 6 6. 假定一个函数原型为“char* func(int n)”,则该函数的返回类型为( )。 a. int b. int* c. char d. char* 7. 假定a为一个字符数组名,则元素ai的指针访问方式为( )。 a. a+i b. *(a+i) c. &a+i d. *a+i 8. 假定有语句为“int *p=calloc(10+20,sizeof(int);”,则p所指向的动态数组中所包含的元素个数为( )。 a. 10 b. 20 c. 30 d. 40 9十进制数50表示成符合c语

3、言规定的八进制数为_。 a. 20 b. 32 c. 62 d. 062 10. 若要以读和写两种操作方式打开一个二进制文件,当文件不存在时返回打开失败信息,则选用的打开方式字符串为( )。 a. r+ b. ab+ c. rb+ d. wb+ 二、填空题(每小题2分,共26分) 1. 在一个c语言程序文件中,若要包含另外一个头文件或程序文件,则应使用的预处理命令为_。 2. 用于从键盘上为变量输入值的标准输入函数的函数名为_。 3. 假定一个枚举类型的定义为“enum raab,ac,ad,ae;”,则ac的值为_。 4double类型的长度为_。 5. 执行“int x=45,y=13;p

4、rintf(%d,x/y);”语句序列后得到的输出结果为_。 6. 把表达式x=x+y转换成复合赋值表达式为_。 7. 假定x的值为5,则执行“a=(!x? 10: 20);”语句后a的值为_。 8. 假定一维字符指针数组的定义为“char* a8;”,则该数组占用的存储空间的字节数为_。 9. 假定二维数组的定义为“double amn;”,则数组元素的行下标取值范围在_之间。 10. 空字符串的长度为_。 11. 在所有函数定义之外定义的变量,若没有被初始化则系统隐含对它所赋的初值为_。 12. 若p指向x,则_与x的表示是等价的。 13. 直接访问表达式(*fp).score所对应的间接

5、访问表达式为_。 三、写出下列每个程序运行后的输出结果(每小题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. #include void main() int a8=76,63,54,95,40,75,90,66; int i, s=0; for(i=0; i=70

6、& 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=8; 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 main() int a5=1,2,3,4,5; int b=la(a,5)+la(a+2,3); printf(b=%dn,b); 四、写出下列每个函数的功能(

7、每小题6分,共12分) 1. int wc(int a, int n, int k) int i, c=0; for(i=0;i=k) c+; return c; 函数功能: 2. void qa(struct worker a, int n) int i; for(i=0; iscore三、写出下列每个程序运行后的输出结果(每小题6分,共30分)评分标准:根据答案正确程度酌情给分。 1. 15 2. 2 5 3. s=241 4. 30 5. b=27四、写出下列每个函数的功能(每小题6分,共12分)评分标准:根据答案叙述正确与完整程度酌情给分。 1. 统计并返回一维整型数组an中大于等于k

8、的值的个数。 2. 从键盘上为具有struct worker类型的数组an输入n个记录。五、按题目要求编写函数(每小题6分,共12分)评分标准:根据函数编写的正确与完整程度酌情给分。 1. double mean(double amn,int m,int n) int i,j; double v=0.0; /1分 for(i=0; im; i+) for(j=0; jn; j+) v+=aij; /4分 v/=m*n; return v; /6分 /注:函数体的最后两行可以合并为一条返回语句:return v/=m*n 2. int mm(int a,int m) int i,x1,x2; x

9、1=x2=a0; /1分 for(i=1; ix1) x1=ai; /3分 if(aix2) x2=ai; /4分 /5分 return x1-x2; /6分 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 is still recovering from a knee injury

10、 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 scorer with nine, closely followed by

11、 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 becoming the first player to win the world cu

12、p 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 anti-racism taskforce, is in london for t

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

14、is 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 dis

15、appointed 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, c

16、onditions 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

17、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 s

18、pace 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 years ago they cruised through to the fin

19、al 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 st

温馨提示

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

评论

0/150

提交评论