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 81

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}

 

Correct Answer: D

 

 

QUESTION 82

Given:

 

final class Folder {//line n1

 

//line n2

 

public void open () {

 

System.out.print(“Open”);

 

}

 

}

 

public class Test {

 

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

 

try (Folder f = new Folder()) {

 

f.open();

 

}

 

}

 

}

 

Which two modifications enable the code to print Open Close?

 

A.

Replace line n1 with:

class Folder implements AutoCloseable {< /span>

B.

Replace line n1 with:

class Folder extends Closeable {

C.

Replace line n1 with:

class Folder extends Exception {

D.

At line n2, insert:

final void close () {

System.out.print(“Close”);

}

E.

At line n2, insert:

public void close () throws IOException {

System.out.print(“Close”);

}

 

Correct Answer: AC

 

 

QUESTION 83

You want to create a singleton class by using the Singleton design pattern. Which two statements enforce the singleton nature of the design?

 

A.

Make the class static.

B.

Make the constructor private.

C.

Override equals() and hashCode() methods of the java.lang.Object class.

D.

Use a static reference to point to the single instance.

E.

Implement the Serializable interface.

 

Correct Answer: AB

 

 

QUESTION 84

Given:

 

interface Doable {

 

public void doSomething (String s);

 

}

 

Which two class definitions compile?

 

A.

public abstract class Task implements Doable {

public void doSomethingElse(String s) { }

}

B.

public abstract class Work implements Doable {

public abstract void doSomething(String s) { }

public void doYourThing(Boolean b) { }

}

C.

public class Job implements Doable {

public void doSomething(Integer i) { }

}

D.

public class Action implements Doable {

public void doSomething(Integer i) { }

public String doThis(Integer j) { }

}

E.

public class Do implements Doable {

public void doSomething(Integer i) { }

public void doSomething(String s) { }

public void doThat (String s) { }

}

 

Correct Answer: CD

 

 

QUESTION 85

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.

 

Correct Answer: D

 

 

QUESTION 86

Given:

 

clip_image002

 

What is the result?

 

A.

Null

B.

Compilation fails

C.

An exception is thrown at runtime

D.

0

 

Correct Answer: C

 

 

QUESTION 87

Given the code format:

 

clip_image004

 

Which code fragment must be inserted at line 6 to enable the code to compile?

 

DBConfiguration f;

return f;

A.

B.

Return DBConfiguration;

C.

Return new DBConfiguration;

D.

Retutn 0;

 

Correct Answer: B

 

 

QUESTION 88

Given the code fragment:

 

UnaryOperator<Integer> uo1 = s -> s*2;line n1

 

List<Double> loanValues = Arrays.asList(1000.0, 2000.0);

&nbsp
;

loanValues.stream()

 

.filter(lv -> lv >= 1500)

 

.map(lv -> uo1.apply(lv))

 

.forEach(s -> System.out.print(s + ” “));

 

What is the result?

 

A.

4000.0

B.

4000

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

 

Correct Answer: B

 

 

 

 

QUESTION 89

Given the code fragment

 

clip_image006

 

Which code fragments, inserted independently, enable the code compile?

 

A.

t.fvar = 200;

B.

cvar = 400;

C.

fvar = 200;

cvar = 400;

D.

this.fvar = 200;

this.cvar = 400;

E.

t.fvar = 200;

Test2.cvar = 400;

F.

this.fvar = 200;

Test2.cvar = 400;

 

Correct Answer: B

 

 

QUESTION 90

Which two statements are true about localizing an application?

 

A.

Support for new regional languages does not require recompilation of the code.

B.

Textual elements (messages and GUI labels) are hard-coded in the code.

C.

Language and region-specific programs are created using localized data.

D.

Resource bundle files include data and currency information.

E.

Language codes use lowercase letters and region codes use uppercase letters.

 

Correct Answer: AE

Explanation:

http://docs.oracle.com/javase/7/docs/technotes/guides/intl/

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 Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

2017 Ensurepass IT Certification PDF and VCE