计算机三级的数据库上机试题及答案
- 计算机三级
- 关注:3.06W次
计算机三级数据库技术是全国计算机等级考试中三级的一类。以下为大家提供的是三级数据库上机考试题,仅供参考!
1. %满足条件的正整数个数,及右移是偶数的个数 平均值
%%%%%%%%%%%%% 40题
int i;
for (i=0;i<200;i++)
{
if(xx[i]>0)
{
totNum++;
if((xx[i]>>1)%2==0)
{totCnt++;
totPjz+=xx[i];
}
}
}
totPjz=totPjz/totCnt;
2.奇数偶数 个数 ,平均值,奇偶数的'方差 83题
%%%%%%%%读函数 未知
for(i=0;i<100;i++)
{
for(j=0;j<10;j++)
fscanf(fp,"%d,",&xx[i*10+j]); //注意此处 的 , 逗号
fscanf(fp,"");
if(feof(fp))
break;
}
/////////
int pp[1000];
int i,j;
for(i=0;i<max;i++)< p="">
{
if(xx[i]%2)
{
odd++;
ave1+=xx[i];
}
else if (xx[i]%2==0)
{
pp[even]=xx[i];
even++;
ave2+=xx[i];
}
}
ave1=ave1/odd;
ave2=ave2/even;
for(j=0;j<even;j++)< p="">
{
totfc+=((pp[j]-ave2)*(pp[j]-ave2));
}
totfc=totfc/even;
3.求 100以上 1000之内素数 并且(个位+十位)/10=百位 的数的个数 ,和
int i,j;
int hun,ten,data;
int half;
for(i=101;i<1000;i++)
{
half=i/2;
for(j=2;j<=half;j++)
{
if(i%j==0)
break;
}
hun=i/100;
ten=i%100/10;
data=i%10;
if((j>half)&&((data+ten)%10==hun))
{
cnt++;
sum+=i;
}
}
4.a1=1;a2=1;a3=a1+2*a2; s(n)=a1+a2+...+an
%求 n 值 s(n)<100,1000,10000>100,1000,10000
int a1,a2,a3;
int s2;
int n,i;
int M[3]={100,1000,10000};
for(i=0;i<3;i++)
{ a1=1;
a2=1;
s2=a1+a2;
n=2;
while(s2<m[i])< p="">
{
a3=a1+2*a2;
s2+=a3;
a1=a2;
a2=a3;
n++;
}
b[i]=n-1;
}
5.选票问题 58题 统计选票 作废的条件不同 84题
int i,j,k;
int cnt;
for(i=0;i<100;i++)
{ j=0;
cnt=0;
while(xx[i][j])
{
if(xx[i][j]=='1')
cnt++;
j++; ////注意循环变量的设置
}
if(cnt==0||cnt==10)
continue;
else
{
for(k=0;k<10;k++) //////这里不用函数 strlen 因为没有库函数
{
if (xx[i][k]=='1')
yy[k]++;
}
}
}
- 文章版权属于文章作者所有,转载请注明 https://xuezhezhai.com/jsj/sanji/k3m59p.html