1 / 120
文档名称:

2012全国计算机等级考试必考机试题库.doc

格式:doc   页数:120
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

2012全国计算机等级考试必考机试题库.doc

上传人:799474576 2013/9/23 文件大小:0 KB

下载得到文件列表

2012全国计算机等级考试必考机试题库.doc

文档介绍

文档介绍:学而优教育二级C上机考试复习资料
(共50套题目)
第1套
1、程序填空题
#include <>
#include <>
double fun(double x)
{ double f, t; int n;
f = + x;
/**********found**********/
t = ___1___;
n = 1;
do {
n++;
/**********found**********/
t *= (-)*x/___2___;
f += t;
}
/**********found**********/
while (___3___ >= 1e-6);
return f;
}
main()
{ double x, y;
x=;
y = fun(x);
printf("\nThe result is :\n");
printf("x=%- y=%-\n", x, y);
}
2、程序修改题
#include <>
long fun(int x,int y,long *p )
{ int i;
long t=1;
/**************found**************/
for(i=1; i<y; i++)
t=t*x;
*p=t;
/**************found**************/
t=t/1000;
return t;
}
main()
{ long t,r; int x,y;
printf("\nInput x and y: "); scanf("%ld%ld",&x,&y);
t=fun(x,y,&r);
printf("\n\nx=%d, y=%d, r=%ld, last=%ld\n\n",x, y,r,t );
}
3、程序设计题
#include <>
#include <>
double fun(double x)
{
}
main()
{ double x,s;
printf("Input x: "); scanf("%lf",&x);
s=fun(x);
printf("s=%f\n",s);
}
第2套
1、程序填空题
#include <>
int c1,c2,c3;
void fun(long n)
{ c1 = c2 = c3 = 0;
while (n) {
/**********found**********/
switch(___1___)
{
/**********found**********/
case 1: c1++;___2___;
/**********found**********/
case 2: c2++;___3___;
case 3: c3++;
}
n /= 10;
}
}
main()
{ long n=123114350L;
fun(n);
printf("\nThe result :\n");
printf("n=%ld c1=%d c2=%d c3=%d\n",n,c1,c2,c3);
}
2、程序修改题
#include <>
int fun(unsigned n, int *zero)
{ int count=0,max=0,t;
do
{ t=n%10;
/**************found**************/
if(t=0)
count++;
if(max<t) max=t;
n=n/10;
}while(n);
/**************found**************/
zero=count;
return max;
}
main()
{ unsigned n; int zero,max;
printf("\nInput n(unsigned): "); scanf("%d",&n);
max = fun( n,&zero );
printf("\nThe result: max=%d zero=%d\n",max,zero);
}
3、程序设计题
#include <>
double fun(int n)
{
}
main()
{ int n; double s;
printf("\nInput n: ")