第1题:
下列程序的运行结果是( )。 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>O) if(c<=0)y=x-y; } else if(c>0)y=x-y; else z=y; printf("%d,%d,%d\n",x,y,z); }
A.2,2,0
B.2,2,2
C.0,2,0
D.2,0,2
第2题:
有以下程序: #include<iostream.h> void main() { int x=5,y=2; cout<<!(y==x/2)<<","; cout<<y!=x%3)<<","; cout<<(x>0&&y<0)<<","; cout<<(x!=y‖x>=y)<<endl: } 程序执行后的输出结果是( )
A.0,0,0,1
B.1,1,1 1
C.0,0, 1,1
D.1,1,0,0
第3题:
Given the logical variables X=0,Y=1,Value of X∧Y(logical multiply) is
A.1
B.2
C.10
D.0
第4题:
下列程序的运行结果是( )。 #include<iostream.h> class Loeation{ private: int X,Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX{returnx;} void valueY(int val){Y=val;} int valueY{return Y;}}; void Location::init(int initX,int initY) {X=initX; Y=initY4} void main(X {Location A,B; A.init; B.value X(5); cout<<A.value X<<endl<<A.value Y<<endl; B.init(6,2); B.value Y(4); eout<<B.value X<<endl<<B.value Y<<endl; }
A.5 0 6 4
B.0 0 6 4
C.5 0 6 2
D.0 0 6 2
第5题:
与“y=(x>0?1:x<0?-1:0)”;的功能相同的if 语句是( )。
A.if(x>0)y=1; else if(x<0)y=1; else y=0;
B.if(x) if(x>0)y=1; else if(x<0)y=-l; else y=0;
C.y=-l if(x) if(x>O)y=1; else if(x=-0)y=0; else y=-l;
D.y=0; if(x>=0) if(x>=0)y=1; else y=-l;
第6题:
下列程序的运行结果是( )。
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);
}
A.2,2,0
B.2,2,2
C.0,2,0
D.2,0,2
第7题:
与“y=(x>0?1:x<0?-1:0)”;的功能相同的if 语句是( )。
A.if(x>0)y=1; else if(x<0)y=1; else="" y="0;
B." x="">0)y=1; else if(x<0)y=-l; else="" y="0;"
C.y="-l" x="">O)y=1; else if(x=-0)y=0; else y=-l;
D.y=0; if(x>=0) if(x>=0)y=1; else y=-l;
第8题:
下面程序段中正确的是( )。
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
第9题:
与y=(x>0? 1:x<0? -1:0);的功能相同的if语句是
A.if(x>0)y=1 else if(x<0)y=-1; else y=O;
B.if(x) if(x>0)y=1; else if(x<0)y=-1;
C.y=-1; if(x) if(x>0)y=1; else if(x==0)y=0; else y=-1;
D.y=0; if(x>=0) if(x>0)y=1; else y=-1;
第10题:
与y=(x>0?1:x<0?-1:0):的功能相同的if语句是( )
A.if(x>0)y=1; else if(x<0)y=-1; else y=0; else y=0;
B.if(x) if(x>0)y=1; else if(x<0)y=-1;
C.y=-1; if(x) if(x>0)y=1; else if(x==0)y=0; else y=-1;
D.y=0; if(x>=0) if(x>0)y=1; else y=-1: