[自考类试卷]2007年下半年全国自考(高级语言程序设计)真题试卷及答案与解析.doc

上传人:roleaisle130 文档编号:911401 上传时间:2019-02-28 格式:DOC 页数:11 大小:50KB
下载 相关 举报
[自考类试卷]2007年下半年全国自考(高级语言程序设计)真题试卷及答案与解析.doc_第1页
第1页 / 共11页
[自考类试卷]2007年下半年全国自考(高级语言程序设计)真题试卷及答案与解析.doc_第2页
第2页 / 共11页
[自考类试卷]2007年下半年全国自考(高级语言程序设计)真题试卷及答案与解析.doc_第3页
第3页 / 共11页
[自考类试卷]2007年下半年全国自考(高级语言程序设计)真题试卷及答案与解析.doc_第4页
第4页 / 共11页
[自考类试卷]2007年下半年全国自考(高级语言程序设计)真题试卷及答案与解析.doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

1、2007 年下半年全国自考(高级语言程序设计)真题试卷及答案与解析一、单项选择题1 可以作为自定义标识符的是( )(A)2x(B) break(C) m-n(D)m-n2 正确的变量定义是( )(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 的足( )(A)5/5%5(B) 52(C)! 4(D)0x7,则能正确执行的语句是( )(A)scanf(“%d,%d“,x-y,x+y) ;(B) printf(“%dn“,a%b) ;(C) prin

2、tf(“%fn“,a+b);(D)scanf(“%d,%d“,x,y) ;7 设 chars10=“abcde“,t=“12345“;则 s 和 t 在内存中分配的字节数分别是( )(A)6 和 5(B) 6 和 6(C) 10 和 5(D)10 和 68 设 inta=10,*p=3;i+)printf(“%5d“,f(i); printf(“n“); 28 #define SIZE 4 main() int nSIZE=8,3,4,1; int i,j; for(i=0;i SIZE;i+) printf(“%d“,ni); for(j=1;j =ni;j+)printf(“*“): pr

3、intf(“n“); 29 int fm(int a,int b) if(b=1)return a; else return a+fm(a,b-1); main() printf(“%dn“,fm(4 ,3); 四、程序填充题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“ ,_);

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

5、出 x 和 y 的值。 #include%math.h #includestdio.h main() float x,y; scanf(“%f“._);/*第一空*/ if(x 0)printf(“input error!n“); else switch(int)(x/2) case 0:yx;_;/*第二空*/ case 1: case 2:y=x*x+1;break ; case 3: case 4:y=_;break;/*第三空*/ default:y=1/(x*x+1); printf(“x=%7.2f,y=%10.6fn“,x,y); 五、程序设计题33 从键盘输入 100 个整数,

6、计算并输出大于等于零的数的平均值(保留小数点后两位)。34 (1) 编写一个计算梯形面积的函数。函数头是:float area(float t,float b,float h)其中变量 t、b 和 h 分别表示梯形的上底、下底和高。 (2) 编写主函数从键盘输入梯形的上底、下底和高的值,调用上述函数输出梯形面积(保留小数点后两位) 。2007 年下半年全国自考(高级语言程序设计)真题试卷答案与解析一、单项选择题1 【正确答案】 D2 【正确答案】 A3 【正确答案】 C4 【正确答案】 D5 【正确答案】 C6 【正确答案】 B7 【正确答案】 D8 【正确答案】 B9 【正确答案】 B10

7、正确答案】 A11 【正确答案】 C12 【正确答案】 A13 【正确答案】 A14 【正确答案】 B15 【正确答案】 D二、填空题16 【正确答案】 117 【正确答案】 (x+sqrt(x+y)/(5*x)/2.0 或 1.0/2*(x+sqrt(x+y)/(5*x)18 【正确答案】 World19 【正确答案】 120 【正确答案】 MySun!21 【正确答案】 2422 【正确答案】 字符型指针或字符型地址23 【正确答案】 924 【正确答案】 325 【正确答案】 -20三、程序分析题26 【正确答案】 b=2 c=327 【正确答案】 6 8 1028 【正确答案】 8*

8、 3* 4* 1*29 【正确答案】 12四、程序填充题30 【正确答案】 num b bi31 【正确答案】 w ch fp32 【正确答案】 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.2fn“,aver); 34 【正确答案】 #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.2fn“,area(t1,b1,h1) ;

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 61643-331-2004 Components for low-voltage surge protective devices - Part 331 Specification for metal oxide varistors (MOV) (IEC 61643-331 2003) German version EN 61643-331 .pdf DIN EN 61643-331-2004 Components for low-voltage surge protective devices - Part 331 Specification for metal oxide varistors (MOV) (IEC 61643-331 2003) German version EN 61643-331 .pdf
  • DIN EN 61643-341-2002 Components for low-voltage surge protection devices - Part 341 Specification for thyristor surge suppressors (TSS) (IEC 61643-341 2001) German version EN 6164.pdf DIN EN 61643-341-2002 Components for low-voltage surge protection devices - Part 341 Specification for thyristor surge suppressors (TSS) (IEC 61643-341 2001) German version EN 6164.pdf
  • DIN EN 61649-2009 Weibull analysis (IEC 61649 2008) German version EN 61649 2008《魏布尔分析》.pdf DIN EN 61649-2009 Weibull analysis (IEC 61649 2008) German version EN 61649 2008《魏布尔分析》.pdf
  • DIN EN 61663-1-2000 Lightning protection - Telecommunication lines - Part 1 Fibre optic installations (IEC 61663-1 1999 + Corrigendum 1999) German version EN 61663-1 1999《雷电防护 通信线路.pdf DIN EN 61663-1-2000 Lightning protection - Telecommunication lines - Part 1 Fibre optic installations (IEC 61663-1 1999 + Corrigendum 1999) German version EN 61663-1 1999《雷电防护 通信线路.pdf
  • DIN EN 61666-2011 Industrial systems installations and equipment and industrial products - Identification of terminals within a system (IEC 61666 2010) German version EN 61666 2010.pdf DIN EN 61666-2011 Industrial systems installations and equipment and industrial products - Identification of terminals within a system (IEC 61666 2010) German version EN 61666 2010.pdf
  • DIN EN 61672-1-2014 Electroacoustics - Sound level meters - Part 1 Specifications (IEC 61672-1 2013) German version EN 61672-1 2013《电声学 声级计 第1部分 规范》.pdf DIN EN 61672-1-2014 Electroacoustics - Sound level meters - Part 1 Specifications (IEC 61672-1 2013) German version EN 61672-1 2013《电声学 声级计 第1部分 规范》.pdf
  • DIN EN 61672-3-2017 Electroacoustics - Sound level meters - Part 3 Periodic tests (IEC 61672-3 2013) German version EN 61672-3 2013《电声学 声级计 第3部分 定期试验(IEC 61672-3-2013) 德文版本EN 61672.pdf DIN EN 61672-3-2017 Electroacoustics - Sound level meters - Part 3 Periodic tests (IEC 61672-3 2013) German version EN 61672-3 2013《电声学 声级计 第3部分 定期试验(IEC 61672-3-2013) 德文版本EN 61672.pdf
  • DIN EN 61674-2015 Medical electrical equipment - Dosimeters with ionization chambers and or semiconductor detectors as used in X-ray diagnostic imaging (IEC 61674 2012) German vers.pdf DIN EN 61674-2015 Medical electrical equipment - Dosimeters with ionization chambers and or semiconductor detectors as used in X-ray diagnostic imaging (IEC 61674 2012) German vers.pdf
  • DIN EN 61675-1-2016 Radionuclide imaging devices - Characteristics and test conditions - Part 1 Positron emission tomographs (IEC 61675-1 2013) German version EN 61675-1 2014《放射性核素.pdf DIN EN 61675-1-2016 Radionuclide imaging devices - Characteristics and test conditions - Part 1 Positron emission tomographs (IEC 61675-1 2013) German version EN 61675-1 2014《放射性核素.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 大学考试

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