
Oracle Upgrade to Java SE 7 Programmer - 1Z0-805 Exam Questions
QUESTION NO: 1
Given:
public class DAOManager {
public AccountDAO getAccountDAO() {
return new AccountJDBCDAO();
}
}
Which design pattern best describes the class?
Given:
public class DAOManager {
public AccountDAO getAccountDAO() {
return new AccountJDBCDAO();
}
}
Which design pattern best describes the class?
Correct Answer: A
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 2
Which code fragment is required to load a JDBC 3.0 driver?
Which code fragment is required to load a JDBC 3.0 driver?
Correct Answer: C
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 3
Which two methods are defined in the FileStore class print disk space information?
Which two methods are defined in the FileStore class print disk space information?
Correct Answer: C,E
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 4
The default file system includes a logFiles directory that contains the following files:
log - Jan2009
log_01_2010
log_Feb2010
log_Feb2011
log-sum-2012
How many files the matcher in this fragment match?
PathMatcher matcher = FileSystems.getDefault ().getPathMatcher ("glob:???_*1");
The default file system includes a logFiles directory that contains the following files:
log - Jan2009
log_01_2010
log_Feb2010
log_Feb2011
log-sum-2012
How many files the matcher in this fragment match?
PathMatcher matcher = FileSystems.getDefault ().getPathMatcher ("glob:???_*1");
Correct Answer: C
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 5
Given the code fragment:
public class App {
public static void main (String [] args) {
path path = paths.get("C\\educations\\institute\\student\\report.txt");
system.out.printIn("getName(0): %s", path.getName(0));
system.out.prinIn("subpath(0, 2): %s" path.subpath(0, 2));
}
}
What is the result?
Given the code fragment:
public class App {
public static void main (String [] args) {
path path = paths.get("C\\educations\\institute\\student\\report.txt");
system.out.printIn("getName(0): %s", path.getName(0));
system.out.prinIn("subpath(0, 2): %s" path.subpath(0, 2));
}
}
What is the result?
Correct Answer: E
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 6
Which statement creates a low-overhead, low contention random number generator that is isolated to a thread to generate a random number between 1 and 100?
Which statement creates a low-overhead, low contention random number generator that is isolated to a thread to generate a random number between 1 and 100?
Correct Answer: B
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 7
Given the code fragment:
public static void main(String[] args) { Path dir = Paths.get("d:\\company");
// insert code here. Line **
for (Path entry: stream) {
System.out.println(entry.getFileName());
}
} catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
Which two try statements, when inserted at line 11, enable you to print files with the extensions.java, .htm, end and .jar.
Given the code fragment:
public static void main(String[] args) { Path dir = Paths.get("d:\\company");
// insert code here. Line **
for (Path entry: stream) {
System.out.println(entry.getFileName());
}
} catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
Which two try statements, when inserted at line 11, enable you to print files with the extensions.java, .htm, end and .jar.
Correct Answer: B,C
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 8
Which three must be used when using the Java.util.concurrent package to execute a task that returns a result without blocking?
Which three must be used when using the Java.util.concurrent package to execute a task that returns a result without blocking?
Correct Answer: A,E,F
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 9
Given this code fragment:
ResultSet rs = null;
try (Connection conn = DriverManager. getConnection (url) ) {
Statement stmt = conn.createStatement();
rs stmt.executeQuery(query);
//-.. other methods } } catch (SQLException se) {
System.out.println ("Error");
}
Which object is valid after the try block runs?
Given this code fragment:
ResultSet rs = null;
try (Connection conn = DriverManager. getConnection (url) ) {
Statement stmt = conn.createStatement();
rs stmt.executeQuery(query);
//-.. other methods } } catch (SQLException se) {
System.out.println ("Error");
}
Which object is valid after the try block runs?
Correct Answer: F
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).




