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

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


QUESTION NO 116
Given:
1. public class Test {
2. public static void main (String []args) {
3. unsigned byte b = 0;
4. b--;
5.
6. }
7. }
What is the value of b at line 5?
A. -1
B. 255
C. 127
D. Compilation will fail.
E. Compilation will succeed but the program will throw an exception at line 4.
Answer: D
QUESTION NO 117
Given:
1. public class Foo {
2. public void main (String [] args) {
3. system.out.printIn(“Hello World.”);
4. }
5. }
What is the result?
A. An exception is thrown.
B. The code does no compile.
C. “Hello World.” Is printed to the terminal.
D. The program exits without printing anything.
Answer: A
QUESTION NO 118
Given:
1. //point X
2. public class foo (
3. public static void main (String[]args) throws Exception {
4. java.io.printWriter out = new java.io.PrintWriter (
5. new java.io.outputStreamWriter (System.out), true;
6. out.printIn(“Hello”);
7. }
8. }
Which statement at PointX on line 1 allows this code to compile and run?
A. Import java.io.*;
B. Include java.io.*;
C. Import java.io.PrintWriter;
D. Include java.io.PrintWriter;
E. No statement is needed.
Answer: E
QUESTION NO 119
Which will declare a method that is available to all members of the same package and can be referenced
without an instance of the class?
A. Abstract public void methoda();
B. Public abstract double methoda();
C. Static void methoda(double d1){}
D. Public native double methoda() {}
E. Protected void methoda(double d1) {}
Answer: C
QUESTION NO 120
Which type of event indicates a key pressed on a java.awt.Component?
A. KeyEvent
B. KeyDownEvent
C. KeyPressEvent
D. KeyTypedEvent
E. KeyPressedEvent
Answer: A
QUESTION NO 121
Exhibit:
1. import java.awt.*;
2.
3. public class X extends Frame {
4. public static void main (String [] args) {
5. X x = new X();
6. x.pack();
7. x.setVisible(true);
8. }
9.
10. public X() {
11. setLayout (new BordrLayout());
12. Panel p = new Panel ();
13. add(p, BorderLayout.NORTH);
14. Button b = new Button (“North”);
15. p.add(b):
16. Button b = new Button (“South”);
17. add(b1, BorderLayout.SOUTH):
18. }
19. }
Which two statements are true? (Choose Two)
A. The buttons labeled “North” and “South” will have the same width.
B. The buttons labeled “North” and “South” will have the same height.
C. The height of the button labeled “North” can very if the Frame is resized.
D. The height of the button labeled “South” can very if the Frame is resized.
E. The width of the button labeled “North” is constant even if the Frame is resized.
F. The width of the button labeled “South” is constant even if the Frame is resized.
Answer: B, E
QUESTION NO 122
How can you create a listener class that receives events when the mouse is moved?
A. By extending MouseListener.
B. By implementing MouseListener.
C. By extending MouseMotionListener.
D. By implementing MouseMotionListener.
E. Either by extending MouseMotionListener or extending MouseListener.
F. Either by implementing MouseMotion Listener or implementing MouseListener.
Answer: D

视频学习

我考网版权与免责声明

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

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

最近更新

社区交流

考试问答