The program runs and prints “i=1, j=0”
The program runs and prints “i=1, j=4”
The program runs and prints “i=3, j=4”
The program runs and prints “i=3, j=0”
An error at line 4 causes compilation to fail.
An error at line 7 causes compilation to fail.
第1题:
下列程序的输出的结果是______。 public class exl6 { public static void main(String[] args) { int j=10; for(int i=0;i<3;i++) { j-=i+1; switch (j){ case 3: break; case 5: break; case 8: break; default: j=0;break; } } System,out.println(j); } }
A.5
B.3
C.8
D.0
第2题:
下列程序输出结果为( )。public class test { public static void main(String args[]) { int a=0; outer: for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { if(j>i) { continue outer; } a++; } } System.out.println(a); }}
A.0
B.2
C.3
D.4
第3题:
以下程序的输出结果为( )。 public class Main { public static void main(String[] args) { int i=0, j=0, a=6; if((++i>0)||(++j>0)) a++; System.out.println( "i=" +i+", j ="+j+", a="+A; } }
A.i=0, j=0, a=6
B.i=1, j=1, a=7
C.i=1, j=0, a=7
D.i=0, j=1, a=7
第4题:
下列语句执行后,i的值是( )。 public class Test { public static void main(String[ ] args) { int i =0; for(int j=10; j>5&&i<5; j-=3,i+=2) i=i+j; System.out.println(i); } }
A.8
B.9
C.10
D.12
第5题:
1. public class ForBar { 2. public static void main(String []args) { 3. int i = 0, j = 5; 4. tp: for (;;) { 5. i ++; 6. for(;;) 7. if(i > --j) break tp; 8. } 9. system.out.printIn(“i = ” + i + “, j = “+ j); 10. } 11. } What is the result?()
第6题:
public class Test { public static void leftshift(int i, int j) { i<<=j; } public static void main(String args[]) { int i = 4, j = 2; leftshift(i, j); System.out.printIn(i); } } What is the result?()
第7题:
public class test( public int aMethod()[ static int i=0; i++; return I; ) public static void main (String args){ test test = new test(); test.aMethod(); int j = test.aMethod(); System.out.printIn(j); ] } What is the result?()
第8题:
public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i < 10 | methodB (4); b = i < 10 || methodB (8); ) public static void main (String args[])( methodA (0); system.out.printIn(j); ) ) What is the result?()
第9题:
The program runs and prints “i=1, j=0”
The program runs and prints “i=1, j=4”
The program runs and prints “i=3, j=4”
The program runs and prints “i=3, j=0”
An error at line 4 causes compilation to fail.
An error at line 7 causes compilation to fail.
第10题:
The program runs and prints “i=1, j=0”
The program runs and prints “i=1, j=4”
The program runs and prints “i=3, j=4”
The program runs and prints “i=3, j=0”
An error at line 4 causes compilation to fail.
An error at line 7 causes compilation to fail.
第11题:
1
2
3
4
5
第12题:
2
4
8
16
The code will not compile.
第13题:
下列程序执行后的结果是______。
public class ex24
{
public static void main(String[] args)
{
int j=10;
a1: for(int i=3;i>0;i--)
{
j-=i;
int m=l;
a2: while (m<j)
{
if (i<=m)
continue a1;
j/=m++;
}
}
System.out.println(j);
}
}
下列嵌套的循环程序执行后,结果是______。 public class ax25 { public static void main(String[] args) { int sum=0; for(int i=0;i<=5;i++) { for(int j=10;j>3*i;j--) { sum+=j*i; } } System.out.println(sum); } }
A.136
B.127
C.147
D.153
第14题:
控制台应用程序 example.java 如下:
public class example
{
public static void main(String[] args)
{
int i=0, j=9;
do
{
if(i++>--j) break;
} while(i<4);
System.out.println("i="+i+" and j="+j);
}
}
第15题:
下列程序输出结果为( )。 public class test { public static void main (String args[]) { int a=0; outer:for(int i=0;i<2;i + +) { for(int j=0;j<2;j+ +) { if(j>i) { continue outer; } a+ +; } } System.out.println(a); } }
A.0
B.2
C.3
D.4
第16题:
A. 0
B. 1
C. 2
D.3
第17题:
public class Foo { public static void main (String []args) { int i = 1; int j = i++; if ((i>++j) && (i++ ==j)) { i +=j; } } } What is the final value of i?()
第18题:
public class ForBar { public static void main(String args) { int i = 0, j = 5; tp: for (;;) { i ++; for(;;) if(i > --j) break tp; } system.out.printIn(“i = ” + i + “, j = “+ j); } } What is the result? ()
第19题:
public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main (String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } } What is the result?()
第20题:
1. public class test ( 2. public static void main(string args[]) { 3. int 1= 0; 4. while (i) { 5. if (i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. ) What is the value of i at line 10?()
第21题:
0
3
4
5
The code will not compile.
第22题:
Value = 3
Value = 4
Value = 5
Value = 6
Value = 7
Value = 8
第23题:
Compilation will fail.
Compilation will succeed and the program will print “0”
Compilation will succeed and the program will print “1”
Compilation will succeed and the program will print “2”
第24题:
The program prints “0”
The program prints “4”
The program prints “8”
The program prints “12”
The code does not complete.