作业帮 > 综合 > 作业

1.以下程序的输出结果是_____.

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 20:21:57
1.以下程序的输出结果是_____.
main()
{
int w = 4,x = 3,y = 2,z = 1;
if (x > y && (z == w)) printf("%d\n",(w < x w :z < y z :x));
else printf("%d\n",(w > x w :z > y z :x));
}
选择一项:
A.2
B.3
C.1
D.4
-----------------------------------
2.以下程序的输出结果是______?
main()
{
float x = 2,y;
if (x < 0)
y = 0;
else if (x < 5 && x)
y = 1 / (x + 2);
else if (x < 10)
y = 1 / x;
else
y = 10;
printf("%f\n",y);
}
选择一项:
A.0
B.10.000000
C.0.250000
D.0.500000
----------------------------------------------
2.执行下列程序段后,x、y和z的值分别是______.
int x = 10,y = 20,z = 30;
if (x > y) z = x; x = y; y = z;
选择一项:
A.10,20,30
B.20,30,10
C.20,30,30
D.20,30,20
---------------------------------
若a和b均是整型变量,以下正确的switch语句是_____.
1.
switch (a / b) {
case 1:case 3.2:y = a+b; break;
case 0:case 5:y = a - b;
}
2.
switch(a * a + b * b);
{
case 3:
case 1:y = a + b; break;
case 0:y = b - a; break;
}
3.
switch a {
default:x = a + b;
case 10:y = a - b; break;
case 11:y = a * d; break;
}
4.
switch (a + b) {
case 10:x = a + b; break;
case 11:y = a - b; break;
}
选择一项:
A.3
B.1
C.4
D.2
-------------------------------------------
执行以下程序段后,a、b和c的值分别是_____.
int a,b = 100,c,x = 10,y = 9;
a = (--x == y++) --x :++y;
if (x < 9) b = x++; c = y;
选择一项:
A.9,9,9
B.9,10,9
C.1,11,10
D.8,8,10
-------------------------
1.以下程序的输出结果是_____.
1、D,2、D,3、C,4、C,5,、D