1z0-809 Free Certification Exam Material from TrainingQuiz with 195 Questions
Use Real 1z0-809 - 100% Cover Real Exam Questions
NEW QUESTION 82
Given:
public interface Moveable<Integer> {
public default void walk (Integer distance) {System.out.println
("Walking");)
public void run(Integer distance);
}
Which statement is true?
- A. Moveablecan be used as below:
Moveable animal = (Integer n) - > System.out.println(n);
animal.run(100);
Moveable.walk(20); - B. Moveablecan be used as below:
Moveable<Integer> animal = n - > System.out.println("Running" + n);
animal.run(100);
animal.walk(20); - C. Moveablecan be used as below:
Moveable<Integer> animal = n - > n + 10;
animal.run(100);
animal.walk(20); - D. Movablecannot be used in a lambda expression.
Answer: B
NEW QUESTION 83
For which three objects must a vendor provide implementations in its JDBC driver?
- A. ResultSet
- B. Connection
- C. Date
- D. SQLException
- E. DriverManager
- F. Statement
- G. Time
Answer: A,B,F
Explanation:
Explanation/Reference:
Explanation: Database vendors support JDBC through the JDBC driver interface or through the ODBC connection. Each driver must provide implementations of java.sql.Connection, java.sql.Statement, java.sql.PreparedStatement, java.sql.CallableStatement, and java.sql.Re sultSet. They must also implement the java.sql.Driver interface for use by the generic java.sql.DriverManager interface.
NEW QUESTION 84 
What is the result?
- A. A compilation error occurs at line 7.
- B. 0
- C. A compilation error occurs at line 8.
- D. A compilation error occurs at line 15.
Answer: A
NEW QUESTION 85
Given:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
public void doRegister(String name, int age)
throws UserException, AgeOutOfLimitException {
if (name.length () < 6) {
throw new UserException ();
} else if (age >= 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println("User is registered.");
}
}
public static void main(String[ ] args) throws UserException {
App t = new App ();
t.doRegister("Mathew", 60);
}
}
What is the result?
- A. User is registered.
- B. An AgeOutOfLimitException is thrown.
- C. A compilation error occurs in the main method.
- D. A UserException is thrown.
Answer: A
NEW QUESTION 86
Given:
What is the result?
- A. Hello Log 1:0
- B. Welcome Log 1:0
- C. Welcome Log 2:1
- D. Hello Log 2:1
Answer: C
NEW QUESTION 87
Given the code fragment:
public void recDelete (String dirName) throws IOException {
File [ ] listOfFiles = new File (dirName) .listFiles();
if (listOfFiles ! = null && listOfFiles.length >0) {
for (File aFile : listOfFiles) {
if (aFile.isDirectory ()) {
recDelete (aFile.getAbsolutePath ());
} else {
if (aFile.getName ().endsWith (".class"))
aFile.delete ();
}
}
}
}
Assume that Projectscontains subdirectories that contain .classfiles and is passed as an argument to the recDelete ()method when it is invoked.
What is the result?
- A. The method deletes all the .classfiles in the Projectsdirectory and its subdirectories.
- B. The method executes and does not make any changes to the Projectsdirectory.
- C. The method throws an IOException.
- D. The method deletes the .classfiles of the Projectsdirectory only.
Answer: A
NEW QUESTION 88
Given:
What is the result?
- A. A NullPointerExceptionis thrown at run time.
- B. A compilation error occurs.
- C. IT:null
- D. IT:0.0
Answer: D
NEW QUESTION 89
Given:
class Vehicle {
int vno;
String name;
public Vehicle (int vno, String name) {
this.vno = vno,;
this.name = name;
}
public String toString () {
return vno + ":" + name;
}
}
and this code fragment:
Set<Vehicle> vehicles = new TreeSet <> ();
vehicles.add(new Vehicle (10123, "Ford"));
vehicles.add(new Vehicle (10124, "BMW"));
System.out.println(vehicles);
What is the result?
- A. 10123 Ford
10124 BMW - B. A compilation error occurs.
- C. A ClassCastExceptionis thrown at run time.
- D. 10124 BMW
1 0123 Ford
Answer: D
NEW QUESTION 90
Given:
public class product { int id; int price;
public Product (int id, int price) {
this.id = id;
this.price = price;
}
public String toString() { return id + ":" + price; }
}
and the code fragment:
List<Product> products = Arrays.asList(new Product(1, 10),
new Product (2, 30),
new Product (2, 30));
Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> {
p1.price+=p2.price;
return new Product (p1.id, p1.price);});
products.add(p);
products.stream().parallel()
.reduce((p1, p2) - > p1.price > p2.price ? p1 : p2)
.ifPresent(System.out: :println);
What is the result?
- A. 2 : 30
- B. 4 : 60
2 : 30
3 : 20
1 : 10 - C. 4 : 60
- D. The program prints nothing.
- E. 4 : 0
Answer: B
NEW QUESTION 91
Given the code fragment:
Which code fragment, when inserted at line 3, enables the code to print 10:20?
- A. int array = new int [2] ;
- B. int [ ] array = new int [2] ;
- C. int array [2] ;
- D. int [ ] array;
Answer: B
NEW QUESTION 92
Given the code fragment:
Map<Integer, String> books = new TreeMap<>();
books.put (1007, "A");
books.put (1002, "C");
books.put (1001, "B");
books.put (1003, "B");
System.out.println (books);
What is the result?
- A. {1001 = B, 1002 = C, 1003 = B, 1007 = A}
- B. {1002 = C, 1003 = B, 1007 = A}
- C. {1007 = A, 1001 = B, 1003 = B, 1002 = C}
- D. {1007 = A, 1002 = C, 1001 = B, 1003 = B}
Answer: A
Explanation:
Explanation/Reference:
Reference: TreeMap inherits SortedMap and automatically sorts the element's key
NEW QUESTION 93
Given:
Which two interfaces can you use to create lambda expressions?
- A. U
- B. Q
- C. S
- D. T
- E. P
- F. R
Answer: A,D
NEW QUESTION 94
Given the code fragment:
BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2;//line n1
System.out.println(val.apply(10, 10.5));
What is the result?
- A. 20.5
- B. A compilation error occurs at line n1.
- C. 0
- D. A compilation error occurs at line n2.
Answer: B
NEW QUESTION 95
Which class definition compiles?
- A. Option A
- B. Option D
- C. Option B
- D. Option C
Answer: A
NEW QUESTION 96
Given the code fragment:
List<String> colors = Arrays.asList("red", "green", "yellow");
Predicate<String> test = n - > {
System.out.println("Searching...");
return n.contains("red");
};
colors.stream()
. filter(c -> c.length() > 3)
. allMatch(test);
What is the result?
- A. A compilation error occurs.
- B. Searching...
Searching...
Searching... - C. Searching...
- D. Searching...
Searching...
Answer: C
NEW QUESTION 97
Given:
Which two interfaces can you use to create lambda expressions? (Choose two.)
- A. U
- B. Q
- C. S
- D. T
- E. P
- F. R
Answer: A,D
NEW QUESTION 98
Given the code fragment:
Which two modifications should you make so that the code compiles successfully?
- A. Replace line 5 with public void printFileContent ( ) throws IOException (
- B. Replace line 13 with:

- C. Replace line 11 with public static void main (String [ ] args) throws Exception (
- D. At line 14, insert throw new IOException ( );
- E. Replace line 7 with throw IOException ("Exception raised");
Answer: A,C
NEW QUESTION 99
Which two statements are true about localizing an application?
- A. Language codes use lowercase letters and region codes use uppercase letters.
- B. Textual elements (messages and GUI labels) are hard-coded in the code.
- C. Support for new regional languages does not require recompilation of the code.
- D. Resource bundle files include data and currency information.
- E. Language and region-specific programs are created using localized data.
Answer: A,C
Explanation:
http://docs.oracle.com/javase/7/docs/technotes/guides/intl/
NEW QUESTION 100
Given:
public interface Moveable<Integer> {
public default void walk (Integer distance) {System.out.println("Walking");)
public void run(Integer distance);
}
Which statement is true?
- A. Movable cannot be used in a lambda expression.
- B. Moveable can be used as below:Moveable<Integer> animal = n - > n +
10;animal.run(100);animal.walk(20); - C. Moveable can be used as below:Moveable<Integer> animal = n - > System.out.println("Running" +
n);animal.run(100);animal.walk(20); - D. Moveable can be used as below:Moveable animal = (Integer n) - >
System.out.println(n);animal.run(100);Moveable.walk(20);
Answer: C
NEW QUESTION 101
Given the code fragment:
BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2;//line
n1
System.out.println(val.apply(10, 10.5));
What is the result?
- A. 20.5
- B. A compilation error occurs at line n1.
- C. 0
- D. A compilation error occurs at line n2.
Answer: B
NEW QUESTION 102
Given the code fragments:
interface CourseFilter extends Predicate<String> {
public default boolean test (String str) {
return str.contains ("Java");
}
}
and
List<String> strs = Arrays.asList("Java", "Java EE", "Embedded Java");
Predicate<String> cf1 = s - > s.length() > 3;
Predicate cf2 = new CourseFilter() { //line n1
public boolean test (String s) {
return s.startsWith ("Java");
}
};
long c = strs.stream()
.filter(cf1)
.filter(cf2//line n2
.count();
System.out.println(c);
What is the result?
- A. 0
- B. A compilation error occurs at line n2.
- C. A compilation error occurs at line n1.
- D. 1
Answer: B
NEW QUESTION 103
......
Dumps Brief Outline Of The 1z0-809 Exam: https://www.trainingquiz.com/1z0-809-practice-quiz.html
1z0-809 Training & Certification Get Latest Java SE : https://drive.google.com/open?id=12xGQH7XBzUiQjlxg-C7WsQ7BiM1hSIiC

