SCJP考试题310-025(第二套)92-147/147

来源:java认证发布时间:2012-11-12 13:05:41java认证视频


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

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答