计算机二级c语言

发布时间 : 星期一 文章计算机二级c语言更新完毕开始阅读

2005年春计算机等级考试(二级C)参考答案

试题一:A,B,B,B,B,A,A,A,B,A 试题二:B,C,B,A,D,A, D,D,C,B 试题三:1、A,D,C 2、C,B,B 3、C,D,A,A 试题四:

1、3#2#0#0#1# 2、2#4#7#11#16# 3、3#10#4#8#

4、95#75#0#60#85# 试题五:

1、 2 #include #include #include float ctof(int c) { void main() return (32+c*9.0/5); {float x,y } printf(“请输入x:”); scanf(“%f”,&x); void main() if (x<0) y=fabs(x); {float F;; int i; else if (x>=0&&x<2) y=sqrt(x+1); printf(“摄氏温度与华氏温度对应表:\\n”); else if (x>=2&&x<4 ) y=pow((x+2),3); else if (x>=4) y=2*x+5; printf(“摄氏温度\\t华氏温度\\n”); printf(“y=%f\\n”,f); for (i=-100;i<=150;i+=5) } printf(“%d\\t%f\\n”,i,ctof(i)); } 3、 #include void main() {int a[10],n,i,j,x,y,max; :”); printf(“请输入一个正整数n(1≤n≤6)scanf(“%d”,&n); printf(“请输入一个n行n列的矩阵:\\n”); for (i=0;imax) {max=a[i][j];x=i;y=j;} printf(“绝对值最大的元素为:%d,下标分别为:%d,%d\\n”,max,x,y); }

2004年秋计算机等级考试 (二级C) 参考答案

试题1~2:ABAAA 试题3:1、BCA

ABBAB

CCDDB

DACBA

2、DCA

3、CD

4、BA

共76页 第49页

试题四、程序阅读题(每题5分,共15分) 1 2 3

1#3# 21# 错1项扣2分 4#47#479#-479 错1项扣2分 IF YOU FAIL TO PL 错1项扣2分

试题五、编程题(每题10分,共20分)

1、 #include #include main( ) { int i, sub, t; int a[10]; for(i=0; i<10; i++) scanf(\ sub=0; for(i=1; i<10; i++) if(abs(a[sub])>abs(a[i])) sub=i; t=a[sub]; a[sub]=a[9]; a[9]=t; for(i=0; i<10; i++) printf(\ } 2、

试题1~2:ABAAB 试题3:1、BAD 试题4、

1、1#2#3#1#1#3

2、3 4 5 #4 5 3 #5 3 4 # 3、298

共76页 第50页

#include main( ) { int flag, i, n; double x, sum; double fact(int n); double mypow(double x, int n); scanf(\ sum = 0; flag = 1; for(i=1; i<=n; i++){ sum = sum + flag*mypow(x,i)/fact(i); flag = -flag; } printf(\} double fact(int n) { int i; double res=1; for(i=1; i<=n; i++) res=res*i; return res; } double mypow(double x, int n) { int i; double res=1; for(i=1; i<=n; i++) res=res*x; return res; } 2003年秋计算机等级考试 (二级C) 参考答案 BABB B

ACBCA 3、BCD

DBBAD

AC

2、DA

联系合同范文客服:xxxxx#qq.com(#替换为@)