FEW QUESTIONS FROM IBM
TEST.
----------------------------
Can any one verify my answers if they are correct:-
12)
An object should be thought of as:
a) A data holder only
b) An entity which combines data and functions on that data to create behavior
c) A place, like a file, to store related methods and no data
d) A template for creating similarly behaving things
My answer : B
15)
With respect to User and Daemon threads:
a) Daemon threads can not be destroyed
b) Running User threads prevent a JVM from terminating program
c) Running Daemon threads prevent a
Java VM from terminating program
d) Daemon threads can not be grouped together
e) The JVM can terminate program when only daemon threads are running
My answer: A/B/E
16)
When comparing Strings and StringBuffers, which of the following statements evaluate correctly and return true:
a) new
String("IBMVAJava") == new String("IBMVAJava")
b) new String("IBMVAJava").toString().equals(new String("IBMVAJava"))
c) new StringBuffer("IBMVAJava") == (new StringBuffer("IBMVAJava"))
d) new StringBuffer("IBMVAJava").equals(new StringBuffer("IBMVAJava"))
My answer: D
20)
AWT components get their look and feel from:
a) Programmable painting support classes
b) SWING classes
c) JVM drawing primitives
d) Peer classes
My answer : D
26)
Based upon the code below, what is drawn:
1. g.setColor(Color.blue.red.yellow);
2. g.fillRect(50, 50, 100, 100);
3. g.setColor(Color.black);
4. g.drawString("Hello World", Font.ITALIC, 24);
a) This code will not compile due to the setColor() method in line 1.
b) This code compiles and runs successfully.
c) A blue square will be drawn.
d) A yellow square will be drawn.
e) The string will not appear since it is drawn after fillRect() is called.
My answer : None is correct
17)
Primitive type wrapper classes:
a) Allow primitive types to behave as reference types
b) Allow operator overloading to be implemented for primitive numeric types
c) Provide string parsing and conversion methods
d) Provide arithmetic operators such as plus and minus
e) Are provided for all primitive types, including void
My answer: A/E
Thanks a lot!