首页 > 计算机科学与技术
题目内容 (请给出正确答案)
[单选题]

以下程序的输出结果是()。 public class koo {public static void main(String args[]) {int x=1, sum=0; while(x=10) {sum+=x; x++;} System.out.println(“sum=”+sum);}}

A.45

B.55

C.10

D.11

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“以下程序的输出结果是()。 public class koo…”相关的问题
第1题
下列程序段的输出结果是()。public class operatorsandExpressions{ void stringPlus(){ int x=3,y=4,z=5; System.out.println(x+y+z); } }

A.以上答案均不正确

B.xyz

C.x+y+z

D.12

点击查看答案
第2题
下列程序段输出的结果是_______。public class NewClass { public static void main(String args[]){ int x=0; boolean b1,b2,b3,b4; b1=b2=b3=b4=true; x=(b1|b2&b3^b4)?++x:x--; System.out.printl
下列程序段输出的结果是_______。public class NewClass { public static void main(String args[]){ int x=0; boolean b1,b2,b3,b4; b1=b2=b3=b4=true; x=(b1|b2&b3^b4)?++x:x--; System.out.printl

A.-1

B.0

C.1

D.2

点击查看答案
第3题
下面程序段的输出结果是_______。public class Test{ public static void main(String args[]){ int n=5,sum=0; while(n>0){ sum+=n; --n; } System.out.println("sum is:"+sum); } }
下面程序段的输出结果是_______。public class Test{ public static void main(String args[]){ int n=5,sum=0; while(n>0){ sum+=n; --n; } System.out.println("sum is:"+sum); } }

A.sum is: 5

B.sum is:15

C.sum is:14

D.sum is:10

点击查看答案
第4题
下列程序段的输出结果是()。 public class operatorsandExpressions{ void stringPlus(){ int xhps0@@3,yhps0@@4,zhps0@@5; System.out.println(x y z); } }

A.以上答案均不正确

B.xyz

C.x y z

D.12

点击查看答案
第5题
下面程序段的输出结果是_______。public class Test{ public static void main(String args[]
){ int x,y; x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2; y=(int)Math.sqrt(3)/2+(int)Math.random()*3/2; if(x>y) System.out.println("x>y");

A.编译错误

B.x>y

C.x=y

D.x

点击查看答案
第6题
以下程序的输出结果是()main(){int x=2,y=-1,z=2;if (x<y) if(y<0) z=0; else z+=1;printf(“%d\n”,z); }

A.3

B.2

C.1

D.0

点击查看答案
第7题
以下程序的输出结果是()。main() {int a=100,x=10,y=20,ok1=5,ok2=0; if(x<y) if(y!=10) if(!ok1) a=1; else if(ok2) a=10; a=-1; printf("%d\n",a );}

A.值不确定

B.1

C.0

D.-1

点击查看答案
第8题
以下程序的输出结果是()。 main() { int a=0,b=1,c=0,d=20; if(a) d=d-10; else if(!b) if(!c) d=15; else d=25; printf("d=%d\n",d);}

A.d=25

B.d=20

C.d=15

D.d=10

点击查看答案
第9题
“阅读下面程序 class ex3124 { public static void main(String [] args) { boolean b=true; if(b){ int i=1;} else { int i=2;}System.out.println(i);}} 现在想先编译再运行该程序,结果是()

A.运行出错

B.编译出错

C.2

D.1

点击查看答案
第10题
下面程序段的输出结果为_______。public class Test { public static void main(String args
[]){ char c1,c2,c3; c1='H'; c2='\\'; c3='\115'; System.out.print(c1); System.out.print(c2); System.out.print(c3);

A.H\M

B.H\\\115

C.H115

D.无输出

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改