Summer Special - Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: top65certs

Java SE 1z0-809 Oracle Study Notes

Page: 12 / 16
Total 208 questions

Java SE 8 Programmer II Questions and Answers

Question 45

Given the code fragment:

Which should be inserted into line n1 to print Average = 2.5?

Options:

A.

IntStream str = Stream.of (1, 2, 3, 4);

B.

IntStream str = IntStream.of (1, 2, 3, 4);

C.

DoubleStream str = Stream.of (1.0, 2.0, 3.0, 4.0);

D.

Stream str = Stream.of (1, 2, 3, 4);

Question 46

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?

Options:

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.

Question 47

Given the code fragments:

and

What is the result?

Options:

A.

The program prints Run… and throws an exception.

B.

A compilation error occurs at line n1.

C.

Run…Call…

D.

A compilation error occurs at line n2.

Question 48

Given:

and the code fragment:

What is the result?

Options:

A.

0

B.

A compilation error occurs at line n1.

C.

An Exception is thrown at run time.

D.

2

Page: 12 / 16
Total 208 questions