SCJP Interview Questions

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

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


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

We Will going to send you more Interview Questions & Answers related toSCJP Interview Questions

AddThis Social Bookmark Button

Leave a Reply