Oracle certification · Exam 1z0-809

1z0-809 Mock Exam

Java SE 8 Programmer II

Find out if you're ready for 1z0-809. Take the free timed mock exam and get your score in minutes, or study the free 1z0-809 questions below with answers and explanations.

20 questions · 33 minutes · free, no sign-up

Free 1z0-809 questions

1–10 of 38 free
Question 1 Choose 2

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

Show answerHide answer

Correct answer: C, D

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

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

Explanation

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

Question 2 Choose 1

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?

Show answerHide answer

Correct answer: C

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

Question 3 Choose 2

Given:
1. abstract class Shape {
2. Shape ( ) { System.out.println (“Shape”); }
3. protected void area ( ) { System.out.println (“Shape”); }
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 (“Square”); }
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 (“Rectangle”); }
21. }
Which two modifications enable the code to compile?

Show answerHide answer

Correct answer: C, D

At line 12, remove public

At line 17, insert super (x);

Question 4 Choose 2

Which two are Java Exception classes?

Show answerHide answer

Correct answer: A, C

SercurityException

DuplicatePathException

Question 5 Choose 1

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-?

Show answerHide answer

Correct answer: C

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

Question 6 Choose 1

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?


Show answerHide answer

Correct answer: B

Make the name variable public.

Question 7 Choose 1

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?

Show answerHide answer

Correct answer: B

A compilation error occurs at line n1.

Question 8 Choose 1

Given:
public class product {
int id; int price;
public Product (int id, int price) {
this.id = id;
this.price = price;
}
public String toString() { return id + “:” + price; }
}
and the code fragment:
List<Product> products = Arrays.asList(new Product(1, 10),
new Product (2, 30),
new Product (2, 30));
Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> {
p1.price+=p2.price;
return new Product (p1.id, p1.price);});
products.add(p);
products.stream().parallel()
.reduce((p1, p2) - > p1.price > p2.price ? p1 : p2)
.ifPresent(System.out: :println);
What is the result?

Show answerHide answer

Correct answer: D

4 : 60
2 : 30
3 : 20
1 : 10

Question 9 Choose 1

Given the code fragment:
List<Integer> values = Arrays.asList (1, 2, 3);
values.stream ()
.map(n -> n*2)//line n1
.peek(System.out::print)//line n2
.count();
What is the result?

Show answerHide answer

Correct answer: A

246

Question 10 Choose 1

Given the fragments

Which line causes a compilation error?

Show answerHide answer

Correct answer: A

Line n1

Full mock exam

Sit the 1z0-809 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real 1z0-809 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full 1z0-809 mock exam
  • 65questions per mock
  • 105 mintime limit
  • 128questions in the bank
  • Newmock on every attempt