文档介绍:Copyright Tarena Corporation,200 9 .All rights reserved
Module 1 -JAVA 基础
一、选择题: Question 1
Given:
35. String #name id main(String[] args) {
12. Integer i = new Integer(1) + new Integer(2);
13. switch(i) {
14. case 3: ( " three " ); break;
15. default: ( " other " ); break;
16. }
17. }
What is the result?
A. three
B. other
C. An exception is thrown at runtime.
D. Compilation fails because of an error on line 12.
E. Compilation fails because of an error on line 13.
F. Compilation fails because of an error on line 15.
Answer: A
Question 6
Given:
11. public static void main(String[] args) {
12. String str = " null " ;
13. if (str = = null) {
14. ( " null " );
15. } else (() == 0)/*少if*/ {
16. ( " zero " );
17. } else {
18. ( " some " );
19. }
20. }
‘ What is the result?
A. null
B. zero
C. some
D. Compilation fails.
E. An exception is thrown at runtime.
Answer: D
Question 7
Given:
x=0;
y =10;
12. do {
l3. y--;
14. ++x;
15. } while (x < 5);
16. (x + " , " + y);
What is the result?
A. 5,6
B. 5,5
C. 6,5
D. 6,6
Answer: B
Question 8
Given:
x=12;
26. while (x < 10) {
27. x--;
28. }
29. (x);
What is the result?
A. 0
B. 10
C. 12
D. Line 29 will never be reached.
Answer: C
Question 9
Given:
35. int x= 10;
36. do {
37. x--;
38. } while(x< 10);
How many times will line 37 be executed?
A. ten times
B. zero times
C. one to me times
D. more than ten times
Answer: D
Question 1 0
Given:
11. public static void main(String[] args) {
12. for (int i=0;i<= 10;i++){
13. if( i>6) break;
14. }
15. (i);
16. }
What is the result?
A. 6
B. 7
C. 10
D. 11
E. Compilation fails.
F. An exception is thrown at runtime.
Answer: E
Question 1 1
Given:
55. int []x= {1, 2,3,4, 5};
y[] =x;
57. (y[2