A.21
B.22
C.23
D.24
[单选题]执行下面的程序段后,x的值为( )。 public class Sun { public static void main(String args[ ]) { int x=5; for(int i=1;i<=20;i=i+2) x=x+i/5; System.out.println(x); } }A.21B.22C.23D.24
[单选题]阅读下面的程序段: public class Sun { public static void main(String args[ ]) { int a=0 for(int i=1;i<=3;i++) { for(int j=1;j<-i;j++) { for(int k=j;k<=3;k++) { a=a+1; } } } System.out.println(A) 我; }}执行上面的3重循环后,a的值为( )。A.3B.9C.14D.21
[单选题]阅读下面的程序段: publiC class Sun { public static void main (String args[ ]) { int a=0; for(int i=1;i<=3;i++) { for(int j=1;j<=i;j++) { for(int k=j;k<=3;k++) { a=a+1; } } } System.out.println(A) ; } } 执行上面的3重循环后,a的值为( )。A.3B.9C.14D.21
[单选题]执行以下的循环后输出的值为( )。 public class Sun { public static void main (String args[ ]) { int m=1000, s=0, n=0; do{ n=n+l; s=s+(int)Math.pow(2,n); }while (s<=m); System.out.println("n="+n+","+"s="+s); } }A.n=9, s=1000B.n=8, s=1022C.n=9, s=1022D.n=8, s=10
[单选题]执行以下的循环后输出的值为( )。 public class Sun { public static void main(String args[ ]) { int m=1000,s=0,n=0; do{ n=n+1; s=s+(int)Math.pow(2,n); }while(s<=m); System.out.println("n="+n+","+"s="+s); } }A.n=9,s=1000B.n=8,s=1022C.n=9,s=1022D.n=8,s=1000
[主观题]执行下面的程序段,输出结果为______。public class Q{public static void main(String argvr)){int anar[]=new int[5];System.out.println(anar[0]);}}
[单选题]下面程序执行后的输出结果为( )。 public class fun { public static void main(String args[]) { String greets = " How are you!"; String s = greets.substring(0,3); System.out.println(s); } }A.HowB.areC.youD.how are you!
[单选题]下面程序的输出结果是( )。 public class Sun { public static void main(String args[]) { int[]a={1,2,3,4}; int j=1,s=0; for(int i=3;i>=0;i--) { s=s+a[i]*j; j=j*10; } System.out.println(s); } }A.1234B.21C.43D.4321
[单选题]下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int i = 1; switch (i) { case 0: System.but.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); default: System.out.println ("
[单选题]下面程序的输出结果是( )。 public class Sun { public static void main (String args[ ]) { int x=0; for (int i=1; i<=4; i++) { x=4; for (int j=1; j<=3; j++) { x=3; for(int k=1;k<=2;k++) { x=x+6; } } } System.out.println (x); } }A.7B.15C.157D.538