举一反三
- 【单选题】分段函数: ,下面程序段中正确的是__________。 A. If x < 0 Then y = 0 If x < 1 Then y = 1 If x < 2 Then y = 2 If x >= 2 Then y = 3 B. If x >= 2 Then y = 3 If x >= 1 Then y = 2 If x > 0 Then y = 1 If x < 0 Then y = 0 C. If x < 0 Then y = 0 ElseIf x > 0 Then y = 1 ElseIf x > 1 Then y = 2 Else y = 3 End If D. If x > =2 Then y = 3 ElseIf x > =1 Then y = 2 ElseIf x > =0 Then y = 1 Else y = 0 End If
- 下面程序段中正确的是( )。 A: If x<0 Then y=0 If x<1 Then y=1 If x<2 Then y=2 If x>=2 Then y=3 B: If x>=2 Then y=3 If x>1 Then y=2 If x>=0Then y=1 If x>0 Then y=0 C: If x<0 Then y=0 Else If>=0Then y=1 Else y=3 End If D: If x>=2 Then y=3 Else If>=1 Then y=2 Else y=0 End If
- 下列程序的运行结果是( )。 x=[0,1,1,0,0]; y=[0,0,1,1,0]; for n=1:3<br/>plot(n*x,n*y)<br/>hold on end axis equal A: 3个左下角在原点的矩形 B: 3个中心在原点的矩形 C: 3条直线 D: 15个点
- 以下程序的运行结果是( )。 main() { int a=-5,b=1,c=1; int x=0,y=2,z=0; if(c>0) x= x + y; if(a<=0) { if(b>0) if(c<=0) y= x - y; } else if(c>0) y= x - y; else z= y; printf("%d,%d,%d\n", x, y, z); }
- 下列程序段运行的结果为( )x=0;if(x>0) y=1;else if(x=0) y=0;else y=-1;printf("%d",y);
内容
- 0
下列语句与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;
- 1
如下程序的运行结果是( ) intx=1,y=1;if(x==1) y=x+1;elseif(y==2) x=y+1;else y=0; A: x=1, y=2 B: x=3, y=2 C: x=3, y=0 D: x=1, y=0
- 2
能够完成如下函数计算的程序段是( )。[img=128x73]18038b85af5fc28.png[/img] A: y=1;if(x!=0) if(x>0) y=1; else y=0; B: if(x>=0) if(x>0) y=1; else y=0;else y=-1; C: y=0; if (x>=0) if (x>0) y=1; else y=-1; D: y=-1;if (x>0) y=1;else y=0;
- 3
设X ~ N ( 0 , 1 ),Y ~ N ( 0 , 1 ),且X与Y相互独立,则D(X – Y) = ( ). A: 1 B: 2 C: 3 D: 4
- 4
The result of the following program is ( ).x=[0,1,1,0,0]; y=[0,0,1,1,0]; for n=1:3 plot(n*x,n*y) hold on end axis equal A: 3 rectangles with lower-left corner at the origin B: 3 rectangles with center at origin C: 3 straight lines D: 15 points