问答题Is the value of x3y-x2y2+xy3 equal to 0?  (1) x=0  (2) y=0

题目
问答题
Is the value of x3y-x2y2+xy3 equal to 0?  (1) x=0  (2) y=0
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第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


正确答案:A
解析: 本题考查if else语句的使用。先判断第1个if语句,因为c=1>0,所以x=x+y=0+2=2。第1个if语句,因为a=-50,所以进入下列的复合语句。经判断发现,复合语句中第2个if语句的条件均不满足,不执行任何语句退出,在这个过程中y和z的值没有发生变化。

第2题:

有以下程序:includevoid main(){ int x=5,y=2; cout<

有以下程序: #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


正确答案:A

第3题:

Given the logical variables X=0,Y=1,Value of X∧Y(logical multiply) is

A.1

B.2

C.10

D.0


正确答案:A

第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


正确答案:A
本题中有成员函数和它的重载函数,要注意它们的不同,在本题中先调用了init函数,初始化了x、Y,都为0,valueX(5);又将x变为5,所以输出5和0,然后初始化init(6,2),接着又valueY(4);将x、Y设为6和4,所以输出6和4。

第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;


正确答案:B
y=(x=)071:x<0?-1:0)中有两个三目运算符,因此按从右到在的顺序运算,可写成y=(x>071:(x<0?-1:0)),故选择8选项。

第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


正确答案:A
解析:本题考查if else语句的使用。 先判断第1个if语句,因为c=1>0,所以x=x+y=0+2=2。第1个 if语句,因为a=-50,所以进入下列的复合语句。经判断发现,复合语句中第2个汀语句的条件均不满足,不执行任何语句退出,在这个过程中y和x的值没有发生变化。

第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;


正确答案:B
y=(x=)071:x<0?-1:0)中有两个三目运算符,因此按从右到在的顺序运算,可写成y=(x>071:(x<0?-1:0)),故选择8选项。

第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=3B

下面程序段中正确的是( )。

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


正确答案:D

第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.i

与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;


正确答案:A
解析:条件运算符要求有三个操作对象,它是c++语言中惟一的一个三目运算符。条件表达式的一般形式为:表达式1?表达式2:表达式3,先求解表达式1,若为非0(真)则求解表达式2,此时表达式2的值就作为整个条件表达式的值。若表达式1的值为0(假),则求解表达式3,表达式3的值就是整个条件表达式的值。本题中用了两次三目运算符。

第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=(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:


正确答案:A