)92-147/147的文章 name=description>


SCJP考试题310-025(第二套<4>)92-147/147
来源:优易学  2011-9-22 20:30:08   【优易学:中国教育考试门户网】   资料下载   IT书店

QUESTION NO: 98
Given:
13. public class Foo {
14. public static void main (String [] args) {
15. StringBuffer a = new StringBuffer (“A”);
16. StringBuffer b = new StringBuffer (“B”);
17. operate (a,b);
18. system.out.printIn{a + “,” +b};
19. )
20. static void operate (StringBuffer x, StringBuffer y) {
21. y.append {x};
22. y = x;
23. )
24. }
What is the result?
A. The code compiles and prints “A,B”.
B. The code compiles and prints “A, BA”.
C. The code compiles and prints “AB, B”.
D. The code compiles and prints “AB, AB”.
E. The code compiles and prints “BA, BA”.
F. The code does not compile because “+” cannot be overloaded for stringBuffer.
Answer: B
QUESTION NO: 99
Given:
1. public class X {
2. public static void main (String[] args) {
3. byte b = 127;
4. byte c = 126;
5. byte d = b + c;
6. }
7. }
Which statement is true?
A. Compilation succeeds and d takes the value 253.
B. Line 5 contains an error that prevents compilation.
C. Line 5 throws an exception indicating “Out of range”
D. Line 3 and 4 contain error that prevent compilation.
E. The compilation succeeds and d takes the value of 1.
Answer: B
QUESTION NO: 100
Given:
1. public class WhileFoo {
2. public static void main (String []args) {
3. int x= 1, y = 6;
4. while (y--) {x--;}
5. system.out.printIn(“x=” + x “y =” + y);
6. }
7. }
What is the result?
A. The output is x = 6 y = 0
B. The output is x = 7 y = 0
C. The output is x = 6 y = -1
D. The output is x = 7 y = -1
E. Compilation will fail.
Answer: E
QUESTION NO: 101
Which statement is true?
A. The Error class is a untimeException.
B. No exceptions are subclasses of Error.
C. Any statement that may throw an Error must be enclosed in a try block.
D. Any statement that may throw an Exception must be enclosed in a try block.
E. Any statement that may thro a runtimeException must be enclosed in a try block.
Answer: D
QUESTION NO: 102
Exhibit:
1. int I=1, j=0
2.
3. switch(i) {
4. case 2:
5. j+=6;
6.
7. case 4:
8. j+=1;
9.
10. default:
11. j +=2;
12.
13. case 0:
14. j +=4;
15. }
16.
What is the value of j at line 16?
A. 0
B. 1
C. 2
D. 4
E. 6
Answer: AE

上一页  [1] [2] [3] [4] [5] [6] [7] [8] 下一页

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训