aiotestking uk

1Z0-809 Exam Questions - Online Test


1Z0-809 Premium VCE File

Learn More 100% Pass Guarantee - Dumps Verified - Instant Download
150 Lectures, 20 Hours

Q1. Given the code fragment: 

List<String> nL = Arrays.asList(“Jim”, “John”, “Jeff”); 

Function<String, String> funVal = s -> “Hello : “.contact(s); 

nL.Stream() 

.map(funVal) 

.peek(System.out::print); 

What is the result? 

A. Hello : Jim Hello : John Hello : Jeff 

B. Jim John Jeff 

C. The program prints nothing. 

D. A compilation error occurs. 

Answer:

Q2. Given: What is the result? 

A. 100 210 

B. Compilation fails due to an error in line n1 

C. Compilation fails due to an error at line n2 

D. Compilation fails due to an error at line n3 

Answer:

Q3. Given: 

public class Foo<K, V> { 

private K key; 

private V value; 

public Foo (K key, V value) (this.key = key; this value = value;) 

public static <T> Foo<T, T> twice (T value) (return new Foo<T, T> (value, value); ) 

public K getKey () (return key;) 

public V getValue () (return value;) 

Which option fails? 

A. Foo<String, Integer> mark = new Foo<String, Integer> (“Steve”, 100); 

B. Foo<String, String> pair = Foo.<String>twice (“Hello World!”); 

C. Foo<?, ?> percentage = new Foo <> (97, 32); 

D. Foo<String, String> grade = new Foo <> (“John”, “A”); 

Answer:

Q4. Which statement is true about the DriverManager class? 

A. It returns an instance of Connection. 

B. it executes SQL statements against the database. 

C. It only queries metadata of the database. 

D. it is written by different vendors for their specific database. 

Answer:

Explanation: The DriverManager returns an instance of Doctrine\DBAL\Connection which is a wrapper around the underlying driver connection (which is often a PDO instance). Reference: http://doctrine-dbal.readthedocs.org/en/latest/reference/configuration.html 

Q5. Given: 

public class Canvas implements Drawable { 

public void draw () { } 

public abstract class Board extends Canvas { } 

public class Paper extends Canvas { 

protected void draw (int color) { } 

public class Frame extends Canvas implements Drawable { 

public void resize () { } 

public interface Drawable { 

public abstract void draw (); 

Which statement is true? 

A. Board does not compile. 

B. Paper does not compile. 

C. Frame does not compile. 

D. Drawable does not compile. 

E. All classes compile successfully. 

Answer:

Q6. Which two are Java Exception classes? 

A. SercurityException 

B. DuplicatePathException 

C. IllegalArgumentException 

D. TooManyArgumentsException 

Answer: A,C 

Q7. Given the code fragment: 

Path p1 = Paths.get(“/Pics/MyPic.jpeg”); System.out.println (p1.getNameCount() + “:” + p1.getName(1) + “:” + p1.getFileName()); 

Assume that the Pics directory does NOT exist. What is the result? 

A. An exception is thrown at run time. 

B. 2:MyPic.jpeg: MyPic.jpeg 

C. 1:Pics:/Pics/ MyPic.jpeg 

D. 2:Pics: MyPic.jpeg 

Answer:

Q8. 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. {1007 = A, 1002 = C, 1001 = B, 1003 = B} 

B. {1001 = B, 1002 = C, 1003 = B, 1007 = A} 

C. {1002 = C, 1003 = B, 1007 = A} 

D. {1007 = A, 1001 = B, 1003 = B, 1002 = C} 

Answer:

Q9. Given the code fragment: 

public static void main (String[] args) throws IOException { 

BufferedReader brCopy = null; 

try (BufferedReader br = new BufferedReader (new FileReader(“employee.txt”))) { // 

line n1 

br.lines().forEach(c -> System.out.println(c)); 

brCopy = br;//line n2 

brCopy.ready(); //line n3; 

Assume that the ready method of the BufferedReader, when called on a closed BufferedReader, throws an exception, and employee.txt is accessible and contains valid text. 

What is the result? 

A. A compilation error occurs at line n3. 

B. A compilation error occurs at line n1. 

C. A compilation error occurs at line n2. 

D. The code prints the content of the employee.txt file and throws an exception at line n3. 

Answer:

Q10. What is the proper way to defined a method that take two int values and returns their sum as an int value? 

A. int sum(int first, int second) { first + second; } 

B. int sum(int first, second) { return first + second; } 

C. sum(int first, int second) { return first + second; } 

D. int sum(int first, int second) { return first + second; } 

E. void sum (int first, int second) { return first + second; } 

Answer: