int x = 1, y =6;
A: x = 6 y = 0
B: x = 7 y = 0
C: x = 6 y = -1
D: x = 7 y = -1
E: Compilation fails.
A: x = 6 y = 0
B: x = 7 y = 0
C: x = 6 y = -1
D: x = 7 y = -1
E: Compilation fails.
举一反三
- 已知int x=6,y;,执行语句y=x,x=y==6;后,变量x的值是______ A: 0 B: 1 C: 6 D: 7
- 阅读以下程序,选择程序的输出结果 A: x = -5 y = -1 B: x =- 7 y = 0 C: x =- 6 y = -1 D: x = 7 y = -1
- 实现如下函数: y=f(x),: 当x=0,1,5, y=0; 当x=2,3,4;y=1; 当x>6, y=2; 当x<0; y=-1;
- 若有说明 int x,y;不能实现以下函数关系的程序段是( )[img=145x83]1802ce1f44e61b4.png[/img] A: y=-1;if (x!=0)if(x>0) y=1;else y=0; B: if (x<0) y=-1; else if(x==0) y=0; else y=1; C: y=0; if (x>=0) { if (x>0) y=1; } else y=-1; D: if (x>=0) if(x>0) y=1; else y=0;else y=-1;
- 下列语句与y=(x>;0?1:x<;0?-1:0);语句功能相同是( ) A: if (x) if(x>;0) y=1; else if(x<;0) y=-1;else y=0; B: y=-1; if(x>;0) y=1; else y=-1; C: if (x>;0) y=1; else if(x<;0) y=-1; else y=0; D: y=0; if(x>;=0) y=1;else if(x==0) y=0; else y=-1;