No output is produced. 1 2 3
No output is produced. 2 3 4
No output is produced. 1 2 3 4
An exception is thrown at runtime. 1 2 3
第1题:
1. public class A { 2. void A() { 3. System.out.println(“Class A”); 4. } 5. public static void main(String[] args) { 6. new A(); 7. } 8. } What is the result?()
第2题:
1. public class Test { 2. public static String output =””; 3. 4. public static void foo(int i) { 5. try { 6. if(i==1) { 7. throw new Exception(); 8. } 9. output += “1”; 10. } 11. catch(Exception e) { 12. output += “2”; 13. return; 14. } 15. finally { 16. output += “3”;17. } 18. output += “4”; 19. } 20. 21. public static void main(String args[]) { 22. foo(0); 23. foo(1); 24. 25. }26. } What is the value of the variable output at line 23?()
第3题:
int i = 0; for (; i <4; i += 2) { System.out.print(i + “”); } System.out.println(i); What is the result?()
第4题:
public classYippee{ public static void main(String[]args){ for(intx=1;xSystem.out.print(args[x]+""); } } } and two separate command line invocations:j avaYippee javaYippee1234 What is the result?()
第5题:
With the following CLI command output performed on an LNS: show l2tp session L2TP session 1/2/3 is up .What is the meaning of the numeric values in the output?()
第6题:
2
3
12
23
123
Compilation fails.
An exception is thrown at runtime.
第7题:
3,2,1,
1,2,3,
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第8题:
Compilation fails.
ClassC is displayed.
The code runs with no output.
An exception is thrown at runtime.
第9题:
No output is produced. 123
No output is produced. 234
No output is produced. 1234
An exception is thrown at runtime. 123
An exception is thrown at runtime. 234
An exception is thrown at runtime. 1234
第10题:
a b c
1 2 3
a1b2c3
a1 b2 c3
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第11题:
Class A
Compilation fails.
An exception is thrown at line 2.
An exception is thrown at line 6.
The code executes with no output.
第12题:
1
2
12
Compilation fails.
No output is produced.
An exception is thrown at runtime.
第13题:
public class Alpha{ public static void main( string[] args ){ if ( args.length == 2 ) { if ( args.[0].equalsIgnoreCase(“-b”) ) System.out.println( new Boolean( args[1] )); } } } And the code is invoked by using the command: java Alpha –b TRUE What is the result?()
第14题:
public class Yippee { public static void main(String [] args) { for(int x = 1; x < args.length; x++) { System.out.print(args[x] +“ “); } } } and two separate command line invocations: java Yippee java Yippee 1234 What is the result?()
第15题:
public static Iterator reverse(List list) { Collections.reverse(list); return list.iterator(); } public static void main(String[] args) { List list = new ArrayList(); list.add(” 1”); list.add(”2”); list.add(”3”); for (Object obj: reverse(list)) System.out.print(obj + “,”); } What is the result?()
第16题:
public class ClassA { public int getValue() { int value=0; boolean setting = true; String title=”Hello”; (value || (setting && title == “Hello”)) { return 1; } (value == 1 & title.equals(”Hello”)) { return 2; } } } And: ClassA a = new ClassA(); a.getValue(); What is the result?()
第17题:
No output is produced. 123
No output is produced. 234
No output is produced. 1234
An exception is thrown at runtime. 123
An exception is thrown at runtime. 234
An exception is thrown at rijntime. 1234
第18题:
42
420
462
42042
Compilation fails.
An exception is thrown at runtime.
第19题:
The code will deadlock.
The code may run with output "2 0 6 4".
The code may run with no output.
The code may run with output "0 6".
An exception is thrown at runtime.
The code may run with output "0 2 4 6".
第20题:
session 1, destination 2, tunnel 3
destination 1, session 2, tunnel 3
tunnel 1, session 2, destination 3
destination 1, tunnel 2, session 3
第21题:
true
null
false
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第22题:
1
2
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第23题:
Hello
Hello World
Compilation fails.
Hello World 5
The code runs with no output.
An exception is thrown at runtime.