电大1253+C语言程序设计A(1月)小抄参考.doc

上传人:爱问知识人 文档编号:5065159 上传时间:2020-01-31 格式:DOC 页数:8 大小:102.50KB
返回 下载 相关 举报
电大1253+C语言程序设计A(1月)小抄参考.doc_第1页
第1页 / 共8页
电大1253+C语言程序设计A(1月)小抄参考.doc_第2页
第2页 / 共8页
电大1253+C语言程序设计A(1月)小抄参考.doc_第3页
第3页 / 共8页
电大1253+C语言程序设计A(1月)小抄参考.doc_第4页
第4页 / 共8页
电大1253+C语言程序设计A(1月)小抄参考.doc_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《电大1253+C语言程序设计A(1月)小抄参考.doc》由会员分享,可在线阅读,更多相关《电大1253+C语言程序设计A(1月)小抄参考.doc(8页珍藏版)》请在三一文库上搜索。

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 b

21、y 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

22、 the stands but not by your team-mates.It is as though their entire tournament has been preparation for the final.In Johnathan Thurston, Cooper Cronk, Cameron Smith and either Billy Slater or Greg Inglis at full-back they have a spine that is unmatched in rugby league. They have played in so many hi

23、gh-pressure games - a priceless asset going into Saturday.The Kiwis are a lot less experienced but winning a dramatic match like their semi-final against England will do wonders for their confidence.They defeated Australia in the Four Nations final in 2010 and the last World Cup, and know they can rise to the big occasion.8

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 绩效管理


经营许可证编号:宁ICP备18001539号-1