Ensurepass
2017 July Oracle Official New Released 1Z0-809 Q&As
100% Free Download! 100% Pass Guaranteed!
http://www.ensurepass.com/1Z0-809.html

Java SE 8 Programmer II

QUESTION 61

Which two code blocks correctly initialize a Locale variable?

 

A.

Locale loc1 = “UK”;

B.

Locale loc2 = Locale.getInstance(“ru”);

C.

Locale loc3 = Locale.getLocaleFactory(“RU”);

D.

Locale loc4 = Locale.UK;

E.

Locale loc5 = new Locale (“ru”, “RU”);

 

Correct Answer: DE

 

 

QUESTION 62

Given the code fragments:

 

class Employee {

 

Optional<Address> address;

Employee (Optional<Address> address) {

 

this.address = address;

 

}

 

public Optional<Address> getAddress() { return address; }

 

}

 

class Address {

 

String city = “New York”;

 

public String getCity { return city: }

 

public String toString() {

 

return city;

 

}

 

}

 

and

 

Address address = null;

 

Optional<Address> addrs1 = Optional.ofNullable (address);

 

Employee e1 = new Employee (addrs1);

 

String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not

 

available”;

 

What is the result?

 

A.

New York

B.

City Not available

C.

null

D.

A NoSuchElementException is thrown at run time.

 

Correct Answer: C

 

 

QUESTION 63

Given:

 

clip_image002

 

What is the result?

 

A.

Initialized

Started

B.

Initialized

Started

Initialized

C.

Compilation fails

D.

An exception is thrown at runtime

 

Correct Answer: B

 

 

QUESTION 64

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.

 

Correct Answer: B

 

 

QUESTION 65

For which three objects must a vendor provide implementations in its JDBC driver?

 

A.

Time

B.

Date

C.

Statement

D.

ResultSet

E.

Connection

F.

SQLException

G.

DriverManager

 

Correct Answer: CDE

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.

 

 

QUESTION 66

Given:

 

public class SampleClass {

 

public static void main(String[] args) {

 

AnotherSampleClass asc = new AnotherSampleClass(); SampleClass sc = new SampleClass();

 

sc = asc;

 

System.out.println(“sc: ” + sc.getClass());

 

System.out.println(“asc: ” + asc.getClass());

 

}}

 

class AnotherSampleClass extends SampleClass {

 

}

 

What is the result?

 

A.

sc: class Object

asc: class AnotherSampleClass

B.

sc: class SampleClass

asc: class AnotherSampleClass

C.

sc: class AnotherSampleClass

asc: class SampleClass

D.

sc: class AnotherSampleClass

asc: class AnotherSampleClass

 

Correct Answer: D

 

 

QUESTION 67

Given:

 

public class Test<T> {

 

private T t;

 

public T get () {

 

return t;

 

}

 

public void set (T t) {

 

this.t = t;

 

}

 

public static void main (String args [ ] ) {

 

Test<String> type = new Test<>();

 

Test type 1 = new Test ();//line n1

 

type.set(“Java”);

 

type1.set(100);//line n2

 

System.out.print(type.get() + ” ” + type1.get());

 

}

 

}

 

What is the result?

 

A.

Java 100

B.

java.lang.string@<hashcode>java.lang.Integer@<hashcode>

C.

A compilation error occurs. To rectify it, replace line n1 with:

Test<Integer> type1 = new Test<>();

D.

A compilation error occurs. To rectify it, replace line n2 with:

type1.set (Integer(100));

 

Correct Answer: C

 

 

QUESTION 68

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.

Searching…

B.

Searching…

Searching…

C.

Searching…

Searching…

Searching…

D.

A compilation error occurs.

 

Correct Answer: D

 

 

 

QUESTION 69

Which two statements are true for a two-dimensional array?

 

A.

It is implemented as an array of the specified element type.

B.

Using a row by column convention, each row of a two-dimensional array must be of the same size.

C.

At declaration time, the number of elements of the array in each dimension must be specified.

D.

All methods of the class Object may be invoked on the two-dimensional array.

 

Correct Answer: AD

 

 

QUESTION 70

Given the code fragment:

 

LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);

 

LocalDate nextYear = valentinesDay.plusYears(1);

 

nextYear.plusDays(15); //line n1

 

System.out.println(nextYear);

 

What is the result?

 

A.

2016-02-14

B.

A DateTimeException is thrown.

C.

2016-02-29

D.

A compilation error occurs at line n1.

 

Correct Answer: B

100% Free Download!
—Download Free Demo:1Z0-809 Demo PDF
100% Pass Guaranteed!
Download 2017 Ensurepass 1Z0-809 Full Exam PDF and VCE Q&As:128
—Get 10% off your purchase! Copy it:TJDN-947R-9CCD [2017.07.01-2017.07.31]

Ensurepass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
PDF + VCE< /th>

Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

2017 Ensurepass IT Certification PDF and VCE