1Z0-804: Java SE Programmer II Dumps: Real Exam Questions




QUESTION NO: 1
Which two forms of abstraction can a programmer use in Java?
A. enums
B. interfaces
C. primitives
D. abstract classes
E. concrete classes
F. primitive wrappers
Answer: B,D

QUESTION NO: 2
Which four are true about enums?
A. An enum is typesafe.
B. An enum cannot have public methods or fields.
C. An enum can declare a private constructor.
D. All enums implicitly implement Comparable.
E. An enum can subclass another enum.
F. An enum can implement an interface.
Answer: A,C,D,F

QUESTION NO: 3
Which two compile?
A. interface Compilable {
void compile();
}
B. interface Compilable {
final void compile();
}
C. interface Compilable {
static void compile();
}
D. interface Compilable {
abstract void compile();
}
E. interface Compilable {
protected abstract void compile ();
}
Answer: A,D

QUESTION NO: 4
Which is a key aspect of composition?
A. Using inheritance
B. Method delegation
C. Creating abstract classes
D. Implementing the composite interface
Answer: B

QUESTION NO: 5
Which two properly implement a Singleton pattern?
A. class Singleton {
private static Singleton instance;
private Singleton () {}
public static synchronized Singleton getInstance() {
if (instance == null) {
instance = new Singleton ();
}
return instance;
}
}
B. class Singleton {
private static Singleton instance = new Singleton();
protected Singleton () {}
public static Singleton getInstance () {
return instance;
}
}
C. class Singleton {
Singleton () {}
private static class SingletonHolder {
private static final Singleton INSTANCE = new Singleton ();
}
public static Singleton getInstance () {
return SingletonHolder.INSTANCE;
}
}
D. enum Singleton {
INSTANCE;
}
Answer: A,D

QUESTION NO: 6
Which statement declares a generic class?
A. public class Example < T > { }
B. public class <Example> { }
C. public class Example <> { }
D. public class Example (Generic) { }
E. public class Example (G) { }
F. public class Example { }
Answer: A

QUESTION NO: 7
Which code fragment correctly appends "Java 7" to the end of the file /tmp/msg.txt?
A. FileWriter w = new FileWriter("/tmp/msg.txt");
append("Java 7");
close();
B. FileWriter w = new FileWriter("/tmp/msg.txt", true);
append("Java 7");
close();
C. FileWriter w = new FileWriter("/tmp/msg.txt", FileWriter.MODE_APPEND);
append("Java 7");
close();
D. FileWriter w = new FileWriter("/tmp/msg.txt", Writer.MODE_APPEND);
append("Java 7");
close();
Answer: B

QUESTION NO: 8
An application is waiting for notification of changes to a tmp directory using the following code
statements:
Path dir = Paths.get("tmp")
WatchKey key = dir.register (watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY) ;
In the tmp directory, the user renames the file testA to testB,
Which statement is true?
A. The events received and the order of events are consistent across all platforms.
B. The events received and the order of events are consistent across all Microsoft Windows
versions.
C. The events received and the order of events are consistent across all UNIX platforms.
D. The events received and the order of events are platform dependent.
Answer: A

QUESTION NO: 9
Which two statements are true about RowSet subinterfaces?
A. A JdbcRowSet object provides a JavaBean view of a result set.
B. A CachedRowSet provides a connected view of the database.
C. A FilteredRowSet object filter can be modified at any time.
D. A WebRowSet returns JSON-formatted data.
Answer: A,C

QUESTION NO: 10
Which two demonstrate the valid usage of the keyword synchronized?
A. interface ThreadSafe {
synchronized void doIt();
}
B. abstract class ThreadSafe {
synchronized abstract void doIt();
}
C. class ThreadSafe {
synchronized static void soIt () {}
}
D. enum ThreadSafe {
ONE, TWO, Three;
synchronized final void doIt () {}
}
Answer: C

I hope you must have find these questions very helpful. If you want to get complete set of real exam questions and their answer please visit our FAQ's section to know more.