while(num=《=2》
{num;printf(“%d、n”,num);}
)
上面程序的输出结果是
A)1 B)1 C)1 D)1
2 2 2
3 3 4
42.请读程序:
#include
main()
{float x,y;
scanf(“%f”,&x);
if(x《0.0》y=0.0
else if((x《5.0》&&(x!=2.0))
y=1.0/(x2.0);
else if(x《10.0》y=1.0/x;
else y=10.0;
printf(“%f、n”,y);
)
若运行时从键盘上输入2.0(表示回车),则上面程序的输出结果是
A)0.000000 B)0.250000
C)0.500000 D)1.000000
43.请读程序:
#include
main()
{int x=1,y=0,a=0,b=0;
switch(x)
{case 1:
switch(y)
{case 0:a;break;
case 1:b;break;
}
case 2:
a;b;break;
}
printf(“a=%d,b=%d、n”,a,b);
}
上面程序输出结果是
A)a=2,b=1 B)a=1,b=1
C)a=1,b=0 D)a=2,b=2
44.若有下面的程序片段:
int a[12]={0},*p[3],**pp,i;
for(i=0;i《3;i》
p[i]=&a[i*4];
pp=p;
则对数组元素的错误引用是
A)PP[0][1]B)a[10]C)P[3][1]D)*(*(P2)2)
45.请读程序:
#include
#includemain(){float x,y,z;
scanf(“%f%f”,&x,&y,),
z=x/y;
while(1)
{if(fabs(z)》1.0)
{x=y;y=z;z=x/y;
}
else break;
}
printf(“%f、n”,y);
}
若运行时从键盘上输入3.6 2.4(表示回车),则输出结果是
A)1.500000 B)1.600000 C)2.000000 D)2.400000]
46.请读程序:
#include
f(int b[],int n)
{int i,r;
r=1;
for(i=0;i《=n;i)r=r*b[i];
return r;
》
main()
{int x,a[]={2,3,4,5,6,7,8,9};
x=f(a,3);
printf(“%d、n”,x);
}
上面程序输出结果是
A》720 B》120 C》24 D》6
47.请读程序:
#include
#include
void fun(char *s)
{char a[10];
strcpy(a,“STRING”);