几道题不会做

来源:百度知道 编辑:UC知道 时间:2024/05/19 14:05:51
答案我知道,但不懂怎么做的,请给出详解,谢谢!!!

3. What is printed out by the following C code fragment?
double x = 9/10;
printf("%f\n", x);
A. 0.000000 −
B. 0.900000
C. 1.000000
D. System dependent.
E. None of the above.

13. What is printed out by the following C code fragment?
int i = 10;
do {
--i;
} while (i--);
printf("%i\n", i);
A. -2
B. -1
C. 0
D. 1
E. None of the above.

7. What is printed out by the following C program fragment?
int a = -1, b = 999/1000, x = 1;
if (a / b > 5 || a)
--x;
else
x++;
printf("%d\n", x);
A. 0
B. 1
C. 2
D. A compilation error will occur.
E. A division-by-zero error will occur. −

5. What is printed out by the following C program fragment?
int i = 0, j = 1;
printf("%i\n", i != j ? i = j : i == j);
A. 0
B.

A: 9/10结果取整数为零,转化为浮点付给x,0.000000

E: while判断的表达式值为: 9, 7, 5...1, -1(0xFFFFFFFF), -3...死循环

E: 同第一题,b为0,抛出除零异常

B: i = j,表达式的值为赋值后i的值1.

B D D B