web analytics

Update 1Z0-809 Dumps with VCE and PDF for Free (Question 21 – Question 30)

PassLeader now are offering 100% pass ensure 1Z0-809 dumps! All 1Z0-809 exam questions have been updated with correct answers, welcome to download the newest PassLeader 1Z0-809 VCE dumps and PDF dumps: https://www.passleader.com/1z0-809.html (132 Q&As –> 201 Q&As)

BTW: Download PassLeader 1Z0-809 dumps from Google Drive for free: https://drive.google.com/open?id=0B-ob6L_QjGLpNTlzOWE4bXRKMmM

QUESTION 21
Given the code fragment:
List<String> str = Arrays.asList (“my”, “pen”, “is”, “your’, “pen”);
Predicate<String> test = s -> {
int i = 0;
boolean result = s.contains (“pen”);
System.out.print(i++) + “:”);
return result;
};
str.stream()
.filter(test)
.findFirst()
.ifPresent(System.out ::print);
What is the result?

A.    0 : 0 : pen
B.    0 : 1 : pen
C.    0 : 0 : 0 : 0 : 0 : pen
D.    0 : 1 : 2 : 3 : 4 : pen
E.    A compilation error occurs

Answer: E

QUESTION 22
Given the code fragment:
public static void main (String [ ] args) throws IOException {
BufferedReader br = new BufferedReader (new InputStremReader (System.in));
System.out.print (“Enter GDP: “);
//line 1
}
Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?

A.    int GDP = Integer.parseInt (br.readline());
B.    int GDP = br.read();
C.    int GDP = br.nextInt();
D.    int GDP = Integer.parseInt (br.next());

Answer: C

QUESTION 23
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: B

QUESTION 24
Given the code fragment:
List<Integer> list1 = Arrays.asList(10, 20);
List<Integer> list2 = Arrays.asList(15, 30);
//line n1
Which code fragment, when inserted at line n1, prints 10 20 15 30?

A.    Stream.of(list1, list2)
.flatMap(list -> list.stream())
.forEach(s -> System.out.print(s + ” “));
B.    Stream.of(list1, list2)
.flatMap(list -> list.intStream())
.forEach(s -> System.out.print(s + ” “));
C.    list1.stream()
.flatMap(list2.stream().flatMap(e1 -> e1.stream())
.forEach(s -> System.out.println(s + ” “));
D.    Stream.of(list1, list2)
.flatMapToInt(list -> list.stream())
.forEach(s -> System.out.print(s + ” “));

Answer: C

QUESTION 25
Given:
public class ScopeTest {
int j, int k;
public static void main(String[] args) {
ew ScopeTest().doStuff(); }
void doStuff() {
nt x = 5;
oStuff2();
System.out.println(“x”);
}
void doStuff2() {
nt y = 7;
ystem.out.println(“y”);
or (int z = 0; z < 5; z++) {
ystem.out.println(“z”);
ystem.out.println(“y”);
}
Which two items are fields? (Choose two.)

A.    j
B.    k
C.    x
D.    y
E.    z

Answer: AB

QUESTION 26
Given the code fragment:
class CallerThread implements Callable<String> {
String str;
public CallerThread(String s) {this.str=s;}
public String call() throws Exception {
return str.concat(“Call”);
}
}
and
public static void main (String[] args) throws InterruptedException, ExecutionException
{
ExecutorService es = Executors.newFixedThreadPool(4);//line n1
Future f1 = es.submit (newCallerThread(“Call”));
String str = f1.get().toString();
System.out.println(str);
}
Which statement is true?

A.    The program prints Call Call and terminates.
B.    The program prints Call Call and does not terminate.
C.    A compilation error occurs at line n1.
D.    An ExecutionException is thrown at run time.

Answer: B

QUESTION 27
Given the structure of the STUDENT table:
Student (id INTEGER, name VARCHAR)
Given:
public class Test {
static Connection newConnection =null;
public static Connection get DBConnection () throws SQLException {
try (Connection con = DriveManager.getConnection(URL, username, password)) {
newConnection = con;
}
return newConnection;
}
public static void main (String [] args) throws SQLException {
get DBConnection ();
Statement st = newConnection.createStatement();
st.executeUpdate(“INSERT INTO student VALUES (102, `Kelvin’)”);
}
}
Assume that:
– The required database driver is configured in the classpath.
– The appropriate database is accessible with the URL, userName, and passWord exists.
– The SQL query is valid.
What is the result?

A.    The program executes successfully and the STUDENT table is updated with one record.
B.    The program executes successfully and the STUDENT table is NOT updated with any record.
C.    A SQLException is thrown as runtime.
D.    A NullPointerException is thrown as runtime.

Answer: D

QUESTION 28
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.    10124 BMW
10123 Ford
C.    A compilation error occurs
D.    A ClassCastException is thrown at run time

Answer: B

QUESTION 29
Given the records from the Employee table:
passleader-1Z0-809-dumps-291
And, given the code fragment:
try {
Connection conn = DriverManager.getConnection (URL, userName, passWord);
Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
st.execute(“SELECT*FROM Employee”);
ResultSet rs = st.getResultSet();
while (rs.next()) {
if (rs.getInt(1) ==112) {
rs.updateString(2, “Jack”);
}
}
rs.absolute(2);
System.out.println(rs.getInt(1) + ” ” + rs.getString(2));
} catch (SQLException ex) {
System.out.println(“Exception is raised”);
}
Assume that:
– The required database driver is configured in the classpath.
– The appropriate database accessible with the URL, userName, and passWord exists.
What is the result?

A.    The Employee table is updated with the row:
112 Jack
and the program prints:
112 Jerry
B.    The Employee table is updated with the row:
112 Jack
and the program prints:
112 Jack
C.    The Employee table is not updated and the program prints:
112 Jerry
D.    The program prints Exception is raised

Answer: D

QUESTION 30
Which action can be used to load a database driver by using JDBC3.0?

A.    Add the driver class to the META-INF/services folder of the JAR file.
B.    Include the JDBC driver class in a jdbc.properties file.
C.    Use the java.lang.Class.forName method to load the driver class.
D.    Use the DriverManager.getDriver method to load the driver class.

Answer: D


PassLeader now are offering 100% pass ensure 1Z0-809 dumps! All 1Z0-809 exam questions have been updated with correct answers, welcome to download the newest PassLeader 1Z0-809 VCE dumps and PDF dumps: https://www.passleader.com/1z0-809.html (132 Q&As –> 201 Q&As)

BTW: Download PassLeader 1Z0-809 dumps from Google Drive for free: https://drive.google.com/open?id=0B-ob6L_QjGLpNTlzOWE4bXRKMmM