level 6
weeksky
楼主
Q11.Given:11. for (int i =0; i < 4; i +=2) {12. System.out.print(i + “”);13. }14. System.out.printIn(i);What is the result?A. 0 2 4B. 0 2 4 5C. 0 1 2 3 4D. Compilation fails.E. An exception is thrown at runtime.Answer: A.Q12.Given:11. int i = 1,j = 10;12. do{13. if (i>j) {14. continue;15. }16. j--;17. } while (++i <6);18. System.out.printIn(“i = “ +i+” and j = “+j);What is the result?A. i = 6 and j = 5B. i = 5 and j = 5C. i = 6 and j = 4D. i = 5 and j = 6E. i = g and j = 6Answer: A.Q13.Given:11. boolean bool = true;12. if(bool = false) {13. System.out.printIn(“a”);14. } else of (bool) {15. System.out.printIn(“c”);16. } else (!bool) {17. System.out.printIn(“c”);18. } else {19. System.out.printIn(“d”);20. }What is the result?A. aB. bC. cD. dE. Compilation fails.Answer: D.Q14.Given:11. Float f = new Float(“12”);12. switch (f) {13. case 12: System.out.printIn(“Twelve”);14. case 0: System.out.printIn(“Zero”);15. default: System.out.printIn(“Default”);16. }What is the result?A. ZeroB. TwelveC. DefaultD. TwelveZeroDefaultE. Compilation fails.Answer: D.Q15.Given:11. switch(x) {12. default:13. System.out.printIn(“Hello”);14. }Which two are acceptable types for x? (Choose two)A. byteB. longC. charD. floatE. ShortF. LongAnswer: A, D.
2007年05月14日 01点05分
1