网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
以下选项中,正确的if-else语句是( )
A.if(x!=0) printf("%d",x) else printf("%d",-x);
B.if(x!=0) { x=x+y;printf("%d",x);} else printf("%d",-x);
C.if(x!=0) x=x+y;printf("%d",x); else printf("%d",-x);
D.if(x!=0) { x=x+y;printf("%d",x)}; else printf("%d",-x);
参考答案
更多 “ 以下选项中,正确的if-else语句是( )A.if(x!=0) printf("%d",x) else printf("%d",-x);B.if(x!=0) { x=x+y;printf("%d",x);} else printf("%d",-x);C.if(x!=0) x=x+y;printf("%d",x); else printf("%d",-x);D.if(x!=0) { x=x+y;printf("%d",x)}; else printf("%d",-x); ” 相关考题
考题
下列条件语句中,功能与其他语句不同的是A.if(A) printf("%d\n",x); else printf("%d\n",y);B.if(a==0) printf("%d\n",y); else printf("%d\n",x);C.if(a!=0) printf("%d\n",x); else printf("%d\n",y);D.if(a==0) printf("%d\n",x); else printf("%d\n",y);
考题
设变量x和y均已正确定义并赋值。以下if语句中,在编译时将产生错误信息的是A.if(x++);B.if(x>yy!=0);C.if(x>0)x- else y++;D.if(y<0){;} else x++;
考题
设变量x和y均已正确定义并赋值。下列if语句中,在编译时将产生错误信息的是( )。A.if(x++);B.if(x>yy!=0);C.if(x>0)x-- elsey++;D.if(y<0){;} else x++;
考题
若x和y是程序中的两个整型变量,则下列if语句中正确的是( )。A.if(x==0)y=l;else y=2;B.if(x==0)theny=1 elsey=2C.if(x=0)y=l else y=2;D.ifx==0y=1 else y=2;
考题
设变量x和y均已正确定义并赋值。下列if语句中,在编译时将产生错误信息的是( )。A.if(x+ +);B.if(x>yy!=0);C.if(x>0)x--D.if(y<0){;} else y+ +; else x+ +;
考题
下列条件语句中,功能与其他语句不同的是______。A.if(b)printf("%d\n",a);else printf("%d\n",c);B.if(b==0)printf("%d\n",c);else printf("%d\n",a);C.if(b!=0)printf("%d\n",a);else printf("%d\n",c);D.if(b=+0)printf("%d\n",a);else printf("%d\n",c);
考题
有定义语句:int a=1,b=2,c=3,x;,则以下选项中各程序段执行后,x的值不为3的是A.if (c<a) x=1; else if (b<a) x=2; else x=3;B.if (a<3) x=3; else if (b<a) x=2; else x=1;C.if (a3) x=3; if (a2) x=2; if (a1) x=1;D.if (a<b) x=b; if (b<c) x=c; if (c<a) x=a;
考题
下列条件语句中,功能与其他语句不同的是A.if(a) printf("%d\n",x); else prinff("%d\n",y);B.if(a==0) printf("%d\n",y); else printf("%d\n",x);C.fi(a!=0) prinff("%d\n"x); else printf("%d\n",y);D.if(a==0) prinff("%d\n",x); else printf("%d\n",y);
考题
下列条件语句中,功能与其他语句不同的是( )。A.if(a) printf("%d\n",x); else printf("%d\n",y);B.if(a==O) printf("%d\n",y); else printf("%d\n",x);C.if(a!=0) printf("%d\n",x); else printf("%d\n",y);D.if(a==0) printf("%d\n",x); else printf("%d\n",y);
考题
有定义语句:int a=1,b=2,c=3,x;,则以下选项中各程序段执行后,x的值不为3的是A.if(c<a) x=1; else if(b<a) x=1; else x=3;B.if(a<3)x=3; else if(a<2)x=2; else x=1;C.if(a<3)x=3; if(a<2)x=2; if(a<1)x=1;D.if(a<b) x=b; if(b<c) x=c; if(c<a) x=a;
考题
以下错误的if语句是:A.if(x>y) z=x;B.if(x==y) z=0;C.if(x!=y) printf("%d",x) else printf("%d",y);D.if(x
考题
与“y=(x0?1:x0?-1:0)”;的功能相同的if 语句是( )。A.if(x0)y=1; else if(x0)y=1; else= y=0;B. x=0)y=1; else if(x0)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;
考题
设变量x和y均已正确定义并赋值,以下if语句中,在编译时将产生错误信息的是( )。A.if(x++);B.if(x>yy!=0);C.if(x>y)x--else y++;D.if(y<0) {;} else x++;
考题
以下if语句书写正确的是( )A.if(x=0;) printf("%f",x); elseprintf("%f",-x);B.if(x>0) {x=x+1;printf("%f",x);} else printf("%f",-x);C.if(x>0); {x=x+1;printf("%f",x);} else printf("%f",-x);D.if(x>0) {x=x+1;printf("%f",x)} else printf("%f",-x);
考题
对于整型变量x,下属if语句()与赋值语句:x=x%2==0?1:0;不等价。
A.if(x%2!=0)x=0;elsex=;B.if(x%2)x=1;elsex=0C.if(x%2==0)x=1;elsex=0D.if(x%2==1)x=0;elsex=1
考题
下列条件语句中,输出结果与其他语句不同的是( )。A.if(a)printf("%d n",x); else print[("%d\n",y)B.if(a=0)pritf("%d n",y); else print[("%d\n",x)C.if(a!一0)printf("%d n",x); else print[("%a\n",y)D.if(a=O)print[("%d n",x); else printf("%d\n",y)
考题
与“y=(x0?1:x0?-1:0)”;的功能相同的if 语句是( )。A.if(x0)y=1; else if(x0)y=1; else y=0;B.if(x) if(x0)y=1; else if(x0)y=-l; else y=0;C.y=-l if(x) if(xO)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;
考题
下列条件语句中,输出结果与其他语句不同的是A.if(a) printf("%d\n",x);else printf("%d\n",y);B.if(a==0) printf("%d\n",y);else pfintf("%d\n",x);C.if(a!=0) printf("%d\n",x);else printf("%d\n",y);D.if(a==0) printf("%d\n",x);else printf("%d\n",y);
考题
与y=(x>0? 1:x0)y=1 else if(x
与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;
考题
与y=(x>0?1:x0)y=1; else if(x
与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:
考题
有一函数:以下程序段中不能根据x值正确计算出y值的是A.if(x0)y=1; else if(x= =0)y=0; else y=-1;B.y=0; if(x0)y=1; else if(x0)y=-1;C.y = 0; if (x = 0) if (x0) y = 1; else y = -1;D.if ( x = 0) if ( x0)y = 1; else y = 0; else y = -1;
考题
以下错误的if语句是( )。A.if(x>y)x++;B.if(x)x++;C.if(x!=y) cout<<x;y++;D.if(x<y) x++;cout<<x;else cout<<y;
考题
下述语句中,_____中的if语句语法是错误的。()A.if(x>y);B.if(x==y)x+=y;C.if(x!=y)seanf("%d",x)else scanf("%d",y);D.if(x<y){x++;y++;}
考题
试题19下列条件语句中,输出结果与其他语句与其他语句不同的是()A. if(a) printf(“%d\n”,x); else printf(“%d\n”, y);B. if(a==0) printf(“%d\n”,y); else printf(“%d\n”, x);C. if(a!=0) printf(“%d\n”,x); else printf(“%d\n”, y);D.if(a==0) printf(“%d\n”,x); else printf(“%d\n”, y);
考题
单选题有以下程序段,若变量已正确定义并赋值
if(ab)printf(x=%d,,x);
elseprintf(y=%d,,y);
if(a=b)i++;
elsej++;
则与此程序段功能相同的选项是( )。A
if(ab)
{
printf(x=%d,,x);
j++
}
else
{
printf(y=%d,,y);
i++
}
B
if(ab){ printf(x=%d,,x); i++}else{ printf(y=%d,,y); j++}C
if(a=b){ printf(x=%d,,x); i++}else{ printf(y=%d,,y); j++}D
if(a=b){ printf(x=%d,,x); i++}else{ printf(y=%d,,y); j++}
热门标签
最新试卷