Updated Free Oracle 1z1-809 Test Engine Questions with 209 Q&As [Q38-Q58]

Share

Updated Free Oracle 1z1-809 Test Engine Questions with 209 Q&As

The Best Java SE 1z1-809 Professional Exam Questions


Oracle 1z1-809 Certification Exam is intended for experienced Java developers who have a deep understanding of Java SE 8. It is recommended that candidates have at least two years of experience working with Java SE 8 before attempting 1z1-809 exam.

 

NEW QUESTION # 38
You are asked to create a method that accepts an array of integers and returns the highest value from that array.
Given the code fragment:

Which method signature do you use at line n1?

  • A. final int findMax (int [ ] )
  • B. static int findMax (int [ ] numbers)
  • C. static int [ ] findMax (int max)
  • D. public int findMax (int [ ] numbers)

Answer: B


NEW QUESTION # 39
Which statement is true about the single abstract method of the java.util.function.Predicate interface?

  • A. It accepts one argument and returns void.
  • B. It accepts an argument and produces a result of any data type.
  • C. It accepts one argument and returns boolean.
  • D. It accepts one argument and always produces a result of the same type as the argument.

Answer: C

Explanation:
References:


NEW QUESTION # 40
Given that version.txt is accessible and contains:
1234567890
and given the code fragment:

What is the result?

  • A. 0
  • B. 1
  • C. 2
  • D. The program prints nothing.

Answer: C


NEW QUESTION # 41
Given the code fragment:

Which modification enables the code to print Price 5 New Price 4?

  • A. Replace line n3 with .forEach (n -> System.out.println ("New Price" + n));
  • B. Replace line n2 with .mapToInt (n -> n ?1);
  • C. Replace line n2 with .map (n -> System.out.println ("New Price" + n ?)) and remove line n3
  • D. Replace line n1 with .forEach (e -> System.out.print ("Price" + e))

Answer: A


NEW QUESTION # 42
The data.doc, data.txt and data.xml files are accessible and contain text.
Given the code fragment:
Stream<Path> paths = Stream.of (Paths. get("data.doc"),
Paths. get("data.txt"),
Paths. get("data.xml"));
paths.filter(s-> s.toString().endWith("txt")).forEach(
s -> {
try {
Files.readAllLines(s)
.stream()
.forEach(System.out::println); //line n1
} catch (IOException e) {
System.out.println("Exception");
}
}
);
What is the result?

  • A. The program prints the content of data.txt file.
  • B. The program prints:
    Exception
    <<The content of the data.txt file>>
    Exception
  • C. A compilation error occurs at line n1.
  • D. The program prints the content of the three files.

Answer: A


NEW QUESTION # 43
Given the code fragment:

What is the result?

  • A. 5 : 3 : 6
  • B. 3 : 3 : 4
  • C. 6 : 5 : 6
  • D. 4 : 4 : 4

Answer: A


NEW QUESTION # 44
Given:

What is the result?

  • A. Compilation fails.
  • B. An ArrayIndexOutOfBoundsException is thrown at runtime.
  • C. null
    Richard
    Donald
  • D. Richard
    Donald
  • E. A NullPointerException is thrown at runtime.

Answer: E


NEW QUESTION # 45
Given:
class Book {
int id;
String name;
public Book (int id, String name) {
this.id = id;
this.name = name;
}
public boolean equals (Object obj) { //line n1
boolean output = false;
Book b = (Book) obj;
if (this.name.equals(b name))}
output = true;
}
return output;
}
}
and the code fragment:
Book b1 = new Book (101, "Java Programing");
Book b2 = new Book (102, "Java Programing");
System.out.println (b1.equals(b2)); //line n2
Which statement is true?

  • A. The program prints false.
  • B. The program prints true.
  • C. A compilation error occurs. To ensure successful compilation, replace line n2 with:System.out.println
    (b1.equals((Object) b2));
  • D. A compilation error occurs. To ensure successful compilation, replace line n1 with:boolean equals
    (Book obj) {

Answer: B


NEW QUESTION # 46
Given the code fragment:
int b = 3;
if ( !(b > 3)) {
System.out.println("square ");
}{
System.out.println("circle ");
}
System.out.println("...");
What is the result?

  • A. circle...
  • B. squarecircle...
  • C. square...
  • D. Compilation fails.

Answer: B


NEW QUESTION # 47
Given:
public class Counter {
public static void main (String[ ] args) {
int a = 10;
int b = -1;
assert (b >=1) : "Invalid Denominator";
int = a / b;
System.out.println (c);
}
}
What is the result of running the code with the -ea option?

  • A. 0
  • B. An AssertionError is thrown.
  • C. A compilation error occurs.
  • D. 1

Answer: A


NEW QUESTION # 48
Given the code fragments:
interface CourseFilter extends Predicate<String> {
public default boolean test (String str) {
return str.equals ("Java");
}
}
and
List<String> strs = Arrays.asList("Java", "Java EE", "Java ME");
Predicate<String> cf1 = s - > s.length() > 3;
Predicate cf2 = new CourseFilter() { //line n1
public boolean test (String s) {
return s.contains ("Java");
}
};
long c = strs.stream()
. filter(cf1)
. filter(cf2 //line n2
. count();
System.out.println(c);
What is the result?

  • A. 0
  • B. A compilation error occurs at line n1.
  • C. 1
  • D. A compilation error occurs at line n2.

Answer: C


NEW QUESTION # 49
Given:

and the code fragment:

What is the result?

  • A. An Exception is thrown at run time.
  • B. A compilation error occurs at line n1.
  • C. 0
  • D. 1

Answer: B


NEW QUESTION # 50
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.lang.string@<hashcode
  • B. Java 100
  • C. A compilation error occurs. To rectify it, replace line n2 with:
    type1.set (Integer(100));
  • D. A compilation error occurs. To rectify it, replace line n1 with:
    Test<Integer> type1 = new Test<>();

Answer: D


NEW QUESTION # 51
Given:

Which statement is true?

  • A. p, r, and s are accessible via obj.
  • B. Both p and s are accessible via obj.
  • C. Both r and s are accessible via obj.
  • D. Only s is accessible via obj.

Answer: D


NEW QUESTION # 52
Given:

Which two interfaces can you use to create lambda expressions? (Choose two.)

  • A. R
  • B. T
  • C. Q
  • D. P
  • E. S
  • F. U

Answer: D,E


NEW QUESTION # 53
Given the code fragments:
4. void doStuff() throws ArithmeticException, NumberFormatException, Exception {
5. if (Math.random() >-1 throw new Exception ("Try again");
6. }
and
24. try {
25. doStuff ( ):
26. } catch (ArithmeticException | NumberFormatException | Exception e) {
27. System.out.println (e.getMessage()); }
28. catch (Exception e) {
29. System.out.println (e.getMessage()); }
30. }
Which modification enables the code to print Try again?

  • A. Replace line 26 with:} catch (ArithmeticException | NumberFormatException e) {
  • B. Replace line 27 with:throw e;
  • C. Replace line 26 with:} catch (Exception | ArithmeticException | NumberFormatException e) {
  • D. Comment the lines 28, 29 and 30.

Answer: A


NEW QUESTION # 54
Given the code fragment:

What is the result?

  • A. A compilation error occurs at line n1.
  • B. The code reads the password without echoing characters on the console.
  • C. A compilation error occurs at line n2.
  • D. A compilation error occurs because the IOException isn't declared to be thrown or caught?

Answer: A


NEW QUESTION # 55
Given the code fragment:

What is the result?

  • A. Compilation fails.
  • B. 1 : 2 : 3 : 4 : 5 :
  • C. 1 : 2 : 3 :
  • D. An ArrayOutOfBoundsException is thrown at runtime.

Answer: B


NEW QUESTION # 56
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 constructor private.
  • B. Implement the Serializable interface.
  • C. Override equals() and hashCode() methods of the java.lang.Object class.
  • D. Make the class static.
  • E. Use a static reference to point to the single instance.

Answer: A,D


NEW QUESTION # 57
Which two methods from the java.util.stream.Streaminterface perform a reduction operation? (Choose two.)

  • A. peek ()
  • B. count ()
  • C. filter ()
  • D. distinct ()
  • E. collect ()

Answer: B,E

Explanation:
Explanation/Reference: https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html


NEW QUESTION # 58
......

Try 100% Updated 1z1-809 Exam Questions [2026]: https://www.troytecdumps.com/1z1-809-troytec-exam-dumps.html

Pass 1z1-809 Exam - Real Questions and Answers: https://drive.google.com/open?id=1j1bQu3HlFdp75t0ZbAJBLegda0fH1qKS