首页 > 计算机等级考试
题目内容 (请给出正确答案)
[主观题]

下面程序段的输出结果是()。public class Test {public static void main (String[] args) {int

下面程序段的输出结果是()。 public class Test { public static void main (String[] args) { int sum=0; for (int i=0;i<=100; i++) sum+=i; System. out. println ("sum="+sum); } }

A.sum =5050

B.sum=4950

C.sum=0

D.sum=100

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“下面程序段的输出结果是()。public class Tes…”相关的问题
第1题
下面程序段的输出结果是public class Test{public static void main(String args[]){int a,b;for

下面程序段的输出结果是 public class Test{ public static void main(String args[]){ int a,b; for(a=1,b=1;a<=100;a++){ if(b>=10)break; if(b%2==1){ b+=2; continue; } } System.out.println(a) ; } }

A.5

B.6

C.7

D.101

点击查看答案
第2题
下面程序段的输出结果是______。public class ex46{ public static void main(String args[]) { S

下面程序段的输出结果是______。 public class ex46 { public static void main(String args[]) { String str="Hello,"; str = str + "Guys!"; System.out .println (str); } }

A.Hello, Guys!

B.Guys!

C.Hello,

D.编译不通过

点击查看答案
第3题
下面程序段的输出结果是()。public class Test {public static void main (String[] args) {int

下面程序段的输出结果是()。 public class Test { public static void main (String[] args) { int n=10; do { System.out.println("n is"+n); }while(--n>10); } }

A.n is 8

B.没有输出

C.n is 10

D.n is 9

点击查看答案
第4题
下面程序段的输出结果是()。 public class Test{ public static void main(String args[]){ in

下面程序段的输出结果是()。 public class Test{ public static void main(String args[]){ int a,b; for(a=1,b=1;a<=100;a++){ if(b>=10)break; if(b%2= =1){ b+=2: continue; } } System.OUt.println(a); } }

A.5

B.6

C.7

D.101

点击查看答案
第5题
下面程序段的输出结果是()。 public class Test{ public static void main(String args[]){ in

下面程序段的输出结果是()。 public class Test{ public static void main(String args[]){ int a,b; for(a=1,b=1;a<=100;a++){ if(b>=10)break; if(b%2= =1){ b+=2: continue; } } System.OUt.println(a); } }

A.5

B.6

C.7

D.101

点击查看答案
第6题
下面程序段的输出结果是()。 public class Test { public static void main(String args[]){int

下面程序段的输出结果是()。 public class Test { public static void main(String args[]){ int a, b; for(a=1, b=1; a<=100; a++){ if(b>=10) break; if (b%2==1) { b+=-2; continue; } } System.out.println(a); } }

A.5

B.6

C.7

D.101

点击查看答案
第7题
下面程序段的输出结果是()。public class Test {public static void main (String[] args) {in

下面程序段的输出结果是()。 public class Test { public static void main (String[] args) { int result=0; for (int i=1;i<=5;i++) { if (i%2==0 ) continue; result + =i; } System. out. println ("result is " + result ); } }

A.result is 7

B.result is 8

C.result is 9

D.result is 10

点击查看答案
第8题
下面程序段的输出结果是______。public class Test{public static void main(String args[ ]){ in

下面程序段的输出结果是______。 public class Test{ public static void main(String args[ ]){ int[ ]a=new int[11]; int[ ]p=new int[4]; int k=5; for(int i=1;i<=10;i++) a[i]=i; for(int i=1;i<=3;i++) p[i]=a[i*i]; for(int i=1;i<=3;i++) k=k+p[i]*2; System.out.println(k); } }

A.37

B.31

C.33

D.35

点击查看答案
第9题
下面程序段的输出结果是 public class Test{ public static void main(String args[]){ int[]a=n

下面程序段的输出结果是 public class Test{ public static void main(String args[]){ int[]a=new int[11]; int[]p=new int[4]; int k=5; for(int i=1;i<=10;i++) a[i]=i; for(int i=1;i<=3;i++) p[i]=a[i*i] for(int i=1;i<=3;i++) k=k+p[i]*2; System.out.println(k); } }

A.37

B.31

C.33

D.35

点击查看答案
第10题
下面程序段的输出结果是class Test{public static void main(String args[]){MyThread t=new MyT

下面程序段的输出结果是 class Test{ public static void main(String args[]){ MyThread t=new MyThread(); t.displayOutput("t has been created)); t.start(); } } class MyThread extends Thread{ public void displayOutput(String s){ System.out.println(s); } public void run(){ displayOutput(t is running."); } }

A.t has been created.

B.t has been created. t is running.

C.t is running.

D.编译出错

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