最新的Oracle Upgrade to Java SE 7 Programmer - 1Z1-805免費考試真題
Given:
Person
public Person(int id)
public int getid()
public String getContactDetails()
public void setContactDetails(String contactDetails) public String getName()
public void setName(String name)
public Person getPerson(int id) throws Exception
public void createPerson(int id) throws Exception
public Person deletePerson(int id) throws Exception
public void updatePerson(Person p) throws Exception
Which group of methods is moved to a new class when implementing the DAO pattern?
Person
public Person(int id)
public int getid()
public String getContactDetails()
public void setContactDetails(String contactDetails) public String getName()
public void setName(String name)
public Person getPerson(int id) throws Exception
public void createPerson(int id) throws Exception
public Person deletePerson(int id) throws Exception
public void updatePerson(Person p) throws Exception
Which group of methods is moved to a new class when implementing the DAO pattern?
正確答案: A
說明:(僅 Fast2test 成員可見)
View the Exhibit:

Given the following code fragment: class Finder extends SimpleFileVisitor<Path> { private final PathMatcher matcher; private static int numMatches = 0;
Finder() {
matcher = FileSystems.getDefault().getPathMatcher("glob:*java");
}
void find(Path file) {
Path Name = file.getFileName();
if (name != null && matcher.matches(name)) {
numMatches++;
}
}
void report()
{
System.out.println("Matched: " + numMatches);
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
find(file);
return CONTINUE;
}
}
public class Visitor {
public static void main(String[] args) throws IOException {
Finder finder = new Finder();
Files.walkFileTree(Paths.get("d:\\Project"), finder);
finder.report();
}
}
What is the result?

Given the following code fragment: class Finder extends SimpleFileVisitor<Path> { private final PathMatcher matcher; private static int numMatches = 0;
Finder() {
matcher = FileSystems.getDefault().getPathMatcher("glob:*java");
}
void find(Path file) {
Path Name = file.getFileName();
if (name != null && matcher.matches(name)) {
numMatches++;
}
}
void report()
{
System.out.println("Matched: " + numMatches);
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
find(file);
return CONTINUE;
}
}
public class Visitor {
public static void main(String[] args) throws IOException {
Finder finder = new Finder();
Files.walkFileTree(Paths.get("d:\\Project"), finder);
finder.report();
}
}
What is the result?
正確答案: E
說明:(僅 Fast2test 成員可見)
Given the code fragment: public class Test {
public static void main (String [] args) {
Path path1 = Paths.get("D:\\sys\\asm\\.\\data\\..\\..\\mfg\\production.log");
System.out.println(path1.normalize());
System.out.println(path1.getNameCount());
}
}
What is the result?
public static void main (String [] args) {
Path path1 = Paths.get("D:\\sys\\asm\\.\\data\\..\\..\\mfg\\production.log");
System.out.println(path1.normalize());
System.out.println(path1.getNameCount());
}
}
What is the result?
正確答案: B
說明:(僅 Fast2test 成員可見)
Given:
class Fibonacci extends RecursiveTask<Integer> {
final int n;
Fibonacci (int n) { this.n = n }
Integer compute () {
if (n <= 1)
return n;
Fibonacci f1 = new Fibonacci (n - 1);
f1.fork;
Fibonacci f2 = new Fibonacci (n - 2);
return f2.compute() + f1.join; // Line **
}
}
Assume that line ** is replaced with:
return f1.join() + f2.compute(); // Line **
What is the likely result?
class Fibonacci extends RecursiveTask<Integer> {
final int n;
Fibonacci (int n) { this.n = n }
Integer compute () {
if (n <= 1)
return n;
Fibonacci f1 = new Fibonacci (n - 1);
f1.fork;
Fibonacci f2 = new Fibonacci (n - 2);
return f2.compute() + f1.join; // Line **
}
}
Assume that line ** is replaced with:
return f1.join() + f2.compute(); // Line **
What is the likely result?
正確答案: D
說明:(僅 Fast2test 成員可見)
Which statement is true about the take method defined in the WatchService interface?
正確答案: C
說明:(僅 Fast2test 成員可見)
Which two descriptions are benefits of using PreparedStatement objects over static SQL in JDBC?
正確答案: D,E
說明:(僅 Fast2test 成員可見)
Given a resource bundle MessageBundle, what is the name of the default bundle file?
正確答案: C
說明:(僅 Fast2test 成員可見)
The advantage of a CallableStatement over a PreparedStatement is that it:
正確答案: C
說明:(僅 Fast2test 成員可見)
Given the code fragment:
List<Person> pList = new CopyOnWriteArrayList<Person>();
Which statement is true?
List<Person> pList = new CopyOnWriteArrayList<Person>();
Which statement is true?
正確答案: A
說明:(僅 Fast2test 成員可見)