【学历类职业资格】高级语言程序设计真题2007年下半年及答案解析.doc

上传人:explodesoak291 文档编号:1380183 上传时间:2019-12-01 格式:DOC 页数:7 大小:58.50KB
下载 相关 举报
【学历类职业资格】高级语言程序设计真题2007年下半年及答案解析.doc_第1页
第1页 / 共7页
【学历类职业资格】高级语言程序设计真题2007年下半年及答案解析.doc_第2页
第2页 / 共7页
【学历类职业资格】高级语言程序设计真题2007年下半年及答案解析.doc_第3页
第3页 / 共7页
【学历类职业资格】高级语言程序设计真题2007年下半年及答案解析.doc_第4页
第4页 / 共7页
【学历类职业资格】高级语言程序设计真题2007年下半年及答案解析.doc_第5页
第5页 / 共7页
点击查看更多>>
资源描述

1、高级语言程序设计真题 2007 年下半年及答案解析(总分:100.00,做题时间:90 分钟)一、B单项选择题/B(总题数:15,分数:30.00)1.可以作为自定义标识符的是( )(分数:2.00)A.2xB.breakC.m-nD.m-n2.正确的变量定义是( )(分数:2.00)A.unsigned long d=1000;B.float m1=m2=10.0;C.char c1=A,c2=A;D.double x=0.618,x=3.14;3.表达式的值为 0 的足( )(分数:2.00)A.5/5%5B.52C.!4D.0x7,则能正确执行的语句是( )(分数:2.00)A.scan

2、f(“%d,%d“,x-y,x+;B.printf(“%d/n“,a%;C.printf(“%f/n“,a+;D.scanf(“%d,%d“,x,;7.设 chars10=“abcde“,t=“12345“;则 s 和 t 在内存中分配的字节数分别是( )(分数:2.00)A.6 和 5B.6 和 6C.10 和 5D.10 和 68.设 inta=10,*p= for(j=1;j=ni;j+)printf(“*“): printf(“/n“); (分数:4.00)_29.int fm(int a,int b) if(b=1)return a; else return a+fm(a,b-1);

3、 main() printf(“%d/n“,fm(4,3); (分数:4.00)_四、B程序填充题/B(总题数:3,分数:18.00)30.函数 fun 用于计算数组各元素值的平方,主函数调用 fun 并输出各元素的值。 void fun(int num,int a) int i; for(i=0;i_;i+)ai=ai*ai; /*第一空*/ main() int i,b5=1,2,3,4,5); fun(5,_); /*第二空*/ for(i=0;i5;i+)printf(“%5d“,_); /*第三空*/ printf(“/n“); (分数:6.00)填空项 1:_31.从键盘输入一串字

4、符(“#“作为结束标志),将其写入文本文件 file.dat 中保存。 #includestdio.h #includestdlih.h main() char ch; FILE*fp: if(fp=fopen(“file.det“,“_“)=NULL)/*第一空*/ printf(“Can not open file/n“);exit(0); ch=getchar(); whil(ch!#) fputc(_,fp);/*第二空*/ ch=getchar(); fclose(_); /*第三空*/ (分数:6.00)填空项 1:_32.从键盘输入 x 的值,根据以下公式计算并输出 x 和 y

5、的值。 (分数:6.00)填空项 1:_五、B程序设计题/B(总题数:2,分数:16.00)33.从键盘输入 100 个整数,计算并输出大于等于零的数的平均值(保留小数点后两位)。(分数:8.00)_34.(1) 编写一个计算梯形面积的函数。函数头是:float area(float t,float b,float h)其中变量t、b 和 h 分别表示梯形的上底、下底和高。 (2) 编写主函数从键盘输入梯形的上底、下底和高的值,调用上述函数输出梯形面积(保留小数点后两位)。(分数:8.00)_高级语言程序设计真题 2007 年下半年答案解析(总分:100.00,做题时间:90 分钟)一、B单项

6、选择题/B(总题数:15,分数:30.00)1.可以作为自定义标识符的是( )(分数:2.00)A.2xB.breakC.m-nD.m-n 解析:2.正确的变量定义是( )(分数:2.00)A.unsigned long d=1000; B.float m1=m2=10.0;C.char c1=A,c2=A;D.double x=0.618,x=3.14;解析:3.表达式的值为 0 的足( )(分数:2.00)A.5/5%5B.52C.!4 D.0x7,则能正确执行的语句是( )(分数:2.00)A.scanf(“%d,%d“,x-y,x+;B.printf(“%d/n“,a%; C.prin

7、tf(“%f/n“,a+;D.scanf(“%d,%d“,x,;解析:7.设 chars10=“abcde“,t=“12345“;则 s 和 t 在内存中分配的字节数分别是( )(分数:2.00)A.6 和 5B.6 和 6C.10 和 5D.10 和 6 解析:8.设 inta=10,*p= for(j=1;j=ni;j+)printf(“*“): printf(“/n“); (分数:4.00)_正确答案:()解析:8* 3* 4* 1*29.int fm(int a,int b) if(b=1)return a; else return a+fm(a,b-1); main() printf

8、d/n“,fm(4,3); (分数:4.00)_正确答案:()解析:12四、B程序填充题/B(总题数:3,分数:18.00)30.函数 fun 用于计算数组各元素值的平方,主函数调用 fun 并输出各元素的值。 void fun(int num,int a) int i; for(i=0;i_;i+)ai=ai*ai; /*第一空*/ main() int i,b5=1,2,3,4,5); fun(5,_); /*第二空*/ for(i=0;i5;i+)printf(“%5d“,_); /*第三空*/ printf(“/n“); (分数:6.00)填空项 1:_ (正确答案:num b

9、bi)解析:31.从键盘输入一串字符(“#“作为结束标志),将其写入文本文件 file.dat 中保存。 #includestdio.h #includestdlih.h main() char ch; FILE*fp: if(fp=fopen(“file.det“,“_“)=NULL)/*第一空*/ printf(“Can not open file/n“);exit(0); ch=getchar(); whil(ch!#) fputc(_,fp);/*第二空*/ ch=getchar(); fclose(_); /*第三空*/ (分数:6.00)填空项 1:_ (正确答案:w ch fp)

10、解析:32.从键盘输入 x 的值,根据以下公式计算并输出 x 和 y 的值。 (分数:6.00)填空项 1:_ (正确答案:iN;i+) if(ai=0) sum=sum+ai: n+; if(n=0)printf(“All numbers are negative!/n“); else aver=sum/n; printf(“aver=%7.2f/n“,aver); 34.(1) 编写一个计算梯形面积的函数。函数头是:float area(float t,float b,float h)其中变量t、b 和 h 分别表示梯形的上底、下底和高。 (2) 编写主函数从键盘输入梯形的上底、下底和高的值,调用上述函数输出梯形面积(保留小数点后两位)。(分数:8.00)_正确答案:()解析:#includestdio.b float area(float t,float b,float h) return(t+b)*h*0.5; main0 float t1,b1,h1; scanf(“%f%f%f“,&t1,&b1,&h1); printf(“area=%7.2f/n“,area(t1,b1,h1);

展开阅读全文
相关资源
猜你喜欢
  • GOST R EN 40-7-2013 Fibre reinforced polymer composite of lighting columns Technical specifications《照明柱的纤维增强聚合物复合材料 技术规格》.pdf GOST R EN 40-7-2013 Fibre reinforced polymer composite of lighting columns Technical specifications《照明柱的纤维增强聚合物复合材料 技术规格》.pdf
  • GOST R EN 404-2011 Occupational safety standards system Respiratory protective devices for self-rescue Filter self-rescuer from carbon monoxide with mouthpiece assembly General spe.pdf GOST R EN 404-2011 Occupational safety standards system Respiratory protective devices for self-rescue Filter self-rescuer from carbon monoxide with mouthpiece assembly General spe.pdf
  • GOST R EN 414-2002 Safety of machinery Rules for the drafting and presentation of safety standards《机械安全 安全标准起草和提交的规则》.pdf GOST R EN 414-2002 Safety of machinery Rules for the drafting and presentation of safety standards《机械安全 安全标准起草和提交的规则》.pdf
  • GOST R EN 482-2012 Workplace atmospheres General requirements for the performance of procedures for the measurement of chemical agents《工作场所的大气环境 化学试剂测量程序性能的通用要求》.pdf GOST R EN 482-2012 Workplace atmospheres General requirements for the performance of procedures for the measurement of chemical agents《工作场所的大气环境 化学试剂测量程序性能的通用要求》.pdf
  • GOST R EN 50194-1-2012 Alarm-only apparatus for the detection of combustible gases in domestic premises Part 1 Test methods and performance requirements《家用易燃气体检测报警装置 第1部分 试验方法和性能要求.pdf GOST R EN 50194-1-2012 Alarm-only apparatus for the detection of combustible gases in domestic premises Part 1 Test methods and performance requirements《家用易燃气体检测报警装置 第1部分 试验方法和性能要求.pdf
  • GOST R EN 50491-4-1-2014 General requirements for Home and Building Electronic Systems (HBES) and Building Automation and Control Systems (BACS) Part 4-1 General functional safety grat.pdf GOST R EN 50491-4-1-2014 General requirements for Home and Building Electronic Systems (HBES) and Building Automation and Control Systems (BACS) Part 4-1 General functional safety grat.pdf
  • GOST R EN 614-1-2003 Safety of machinery Ergonomic design principles Part 1 Terms definitions and general principles《机械安全性 人体工程学设计准则 第1部分 术语 定义和总则》.pdf GOST R EN 614-1-2003 Safety of machinery Ergonomic design principles Part 1 Terms definitions and general principles《机械安全性 人体工程学设计准则 第1部分 术语 定义和总则》.pdf
  • GOST R EN 779-2014 Particulate air filters for general ventilation Determination of the filtration performance《一般通风用微粒空气过滤器 过滤性能的测定》.pdf GOST R EN 779-2014 Particulate air filters for general ventilation Determination of the filtration performance《一般通风用微粒空气过滤器 过滤性能的测定》.pdf
  • GOST R EN 848-1-2011 Safety of woodworking machines One side milling machines Part 1 Single spindle milling machines with vertical lower arrangement of spindle《木工机械安全性 单边铣床 第1部分 带有.pdf GOST R EN 848-1-2011 Safety of woodworking machines One side milling machines Part 1 Single spindle milling machines with vertical lower arrangement of spindle《木工机械安全性 单边铣床 第1部分 带有.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1