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 1

Which two statements are true for a two-dimensional array of primitive data type?

 

A.

It cannot contain elements of different types.

B.

The length of each dimension must be the same.

C.

At the 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: CD

Explanation:

http://stackoverflow.com/questions/12806739/is-an-array-a-primitive-type-or-an-object-or-something-else-entirely< /p>

 

 

QUESTION 2

Given the fragments:

 

clip_image002

 

Which line causes a compilation error?

 

A.

Line n1

B.

Line n2

C.

Line n3

D.

Line n4

< p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none" align="left"> 

Correct Answer: A

 

 

QUESTION 3

Given the code fragment:

 

List<String> listVal = Arrays.asList(“Joe”, “Paul”, “Alice”, “Tom”);

 

System.out.println (

 

// line n1

 

);

 

Which code fragment, when inserted at line n1, enables the code to print the count of string elements whose length is greater than three?

 

A.

listVal.stream().filter(x -> x.length()>3).count()

B.

listVal.stream().map(x -> x.length()>3).count()

C.

listVal.stream().peek(x -> x.length()>3).count().get()

D.

listVal.stream().filter(x -> x.length()>3).mapToInt(x -> x).count()

 

Correct Answer: C

 

 

QUESTION 4

Given:

 

1. abstract class Shape {

 

2. Shape ( ) { System.out.println (hape?; }

 

3. protected void area ( ) { System.out.println (hape?; }

 

4. }

 

5.

 

6. class Square extends Shape {

 

7. int side;

 

8. Square int side {

 

9./* insert code here */

 

10. this.side = side;

 

11. }

 

12. public void area ( ) { System.out.println (quare?; }

 

13. }

 

14. class Rectangle extends Square {

 

15. int len, br;

 

16. Rectangle (int x, int y) {

 

17. /* insert code here */

 

18. len = x, br = y;

 

19. }

20. void area ( ) { System.out.println (ectangle?; }

 

21. }

 

Which two modifications enable the code to compile?

 

A.

At line 1, remove abstract

B.

At line 9, insert super ( );

C.

At line 12, remove public

D.

At line 17, insert super (x);

E.

At line 17, insert super (); super.side = x;

F.

At line 20, use public void area ( ) {

 

Correct Answer: CD

 

 

QUESTION 5

Which two are Java Exception classes?

 

A.

SercurityException

B.

DuplicatePathException

C.

IllegalArgumentException

D.

TooManyArgumentsException

 

Correct Answer: AC

 

 

QUESTION 6

Given the code fragments:

 

class TechName {

 

String techName;

 

TechName (String techName) {

 

this.techName=techName;

 

}

 

}

 

and

 

List<TechName> tech = Arrays.asList (

 

new TechName(“Java-“),

 

new TechName(“Oracle DB-“),

 

new TechName(“J2EE-“)

 

);

 

Stream<TechName> stre = tech.stream();

 

//line n1

 

Which should be inserted at line n1 to print Java-Oracle DB-J2EE-?

 

A.

stre.forEach(System.out::print);

B.

stre.map(a-> a.techName).forEach(System.out::print);

C.

stre.map(a-> a).forEachOrdered(System.out::print);

D.

stre.forEachOrdered(System.out::print);

 

Correct Answer: C

 

 

QUESTION 7

Given the definition of the Vehicle class:

 

class Vehicle {

 

String name;

 

void setName (String name) {

 

this.name = name;

 

}

 

String getName() {

 

return name;

 

}

 

}

 

Which action encapsulates the Vehicle class?

 

A.

Make the Vehicle class public.

B.

Make the name variable public.

C.

Make the setName method public.

D.

Make the name variable private.

E.

Make the setName method private.

F.

Make the getName method private.

 

Correct Answer: B

 

 

QUESTION 8

Given the code fragment:

 

List<String> empDetails = Arrays.asList(“100, Robin, HR”,

 

“200, Mary, AdminServices”,

 

“101, Peter, HR”);

 

empDetails.stream()

 

.filter(s-> s.contains(“1”))

 

.sorted()

 

.forEach(System.out::println); //line n1

 

What is the result?

 

A.

100, Robin, HR

101, Peter, HR

B.

A compilation error occurs at line n1.

C.

100, Robin, HR

101, Peter, HR

200, Mary, AdminServices

D.

100, Robin, HR

200, Mary, AdminServices

101, Peter, HR

 

Correct Answer: C

 

 

QUESTION 9

Given:

 

clip_image004

 

What is the result?

 

A.

The program prints nothing

B.

A NullPointerException is thrown at runtime.

C.

A StringIndexOutOfBoundsException is thrown at runtime.

D.

AnArrayIndexOutOfBoundsException is thrown at runtime.

 

Correct Answer: C

 

 

QUESTION 10

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”);

 

Correct Answer: C

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