SCJP - Page -3



21.)
You need to store elements in a collection that guarantees that no duplicates are stored. Which two interfaces provide that capability? (Choose Two)

a. Java.util.Map
b. Java.util.Set
c. Java.util.List
d. Java.util.StoredSet
e. Java.util.StoredMap
f. Java.util.Collection
22.)
Which type of event indicates a key pressed on a java.awt.Component?

a. KeyEvent
b. KeyDownEvent
c. KeyPressEvent
d. KeyTypedEvent
e. KeyPressedEvent
23.)
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) {}
24.)
Which two statements are true regarding the creation of a default constructor? (Choose Two)

a. The default constructor initializes method variables.
b. The compiler always creates a default constructor for every class.
c. The default constructor invokes the no-parameter constructor of the superclass.
d. The default constructor initializes the instance variables declared in the class.
e. When a class has only constructors with parameters, the compiler does not create a
default constructor.
25.)
Which two can directly cause a thread to stop executing? (Choose Two)

a. Exiting from a synchronized block.
b. Calling the wait method on an object.
c. Calling the notify method on an object.
d. Calling the notifyAll method on an object.
e. Calling the setPriority method on a thread object.
26.)
Which statement about static inner classes is true?

a. An anonymous class can be declared as static.
b. A static inner class can not be a static member of the outer class.
c. A static inner class does not require an instance of the enclosing class.
d. Instance members of a static inner class can be referenced using the class name of the
static inner class.
27).
Which two CANNOT directly cause a thread to stop executing? (Choose Two)

a. Existing from a synchronized block.
b. Calling the wait method on an object.
c. Calling notify method on an object.
d. Calling read method on an InputStream object.
e. Calling the SetPriority method on a Thread object.

28.)
Which two are equivalent? (Choose Two).

a. 3/2
b. 3<2
c. 3*4
d. 3<<2
e. 3*3^2
f. 3<<<2
29.)
Which two statements are reserved words in Java? (Choose Two)

a. Run
b. Import
c. Default
d. Implemen
30.)
Given:

1. switch (i) {
2. default:
3. System.out.println(“Hello”);
4. }

What are the two acceptable types for the variable i? (Choose Two)

a. Char
b. Byte
c. Float
d. Double
e. Object