Q16
What will be written to the standard output when the following program is run?
public class Q63e3 {
public static void main(String args[]) {
System.out.println(9 ^ 2);
}
}
1) 81
2) 7
3) 11
4) 0
5) false
Q17
Which statements are true concerning the default layout manager for containers in the java.awt package?
1) Objects instantiated from Panel do not have a default layout manager.
2) Objects instantiated from Panel have FlowLayout as default layout manager.
3) Objects instantiated from Applet have BorderLayout as default layout manager.
4) Objects instantiated from Dialog have BorderLayout as default layout manager.
5) Objects instantiated from Window have the same default layout manager as instances of Applet.
Q18
Which declarations will allow a class to be started as a standalone program?
1) public void main(String args[])
2) public void static main(String args[])
3) public static main(String[] argv)
4) final public static void main(String [] array)
5) public static void main(String args[])
Q19
Under which circumstances will a thread stop?
1) The method waitforId() in class MediaTracker is called.
2) The run() method that the thread is executing ends.
3) The call to the start() method of the Thread object returns.
4) The suspend() method is called on the Thread object.
5) The wait() method is called on the Thread object.
Q20
When creating a class that associates a set of keys with a set of values, which of these interfaces is most applicable?
1) Collection
2) Set
3) SortedSet
4) Map
Q21
What does the value returned by the method getID() found in class java.awt.AWTEvent uniquely identify?
1) The particular event instance.
2) The source of the event.
3) The set of events that were triggered by the same action.
4) The type of event.
5) The type of component from which the event originated.
Q22
What will be written to the standard output when the following program is run?
class Base {
int i;
Base() {
add(1);
}
void add(int v) {
i += v;
}
void print() {
System.out.println(i);
}
}
class Extension extends Base {
Extension() {
add(2);
}
void add(int v) {
i += v*2;
}
}
public class Qd073 {
public static void main(String args[]) {
bogo(new Extension());
}
static void bogo(Base b) {
b.add(8);
b.print();
}
}
1) 9
2) 18
3) 20
4) 21
5) 22