Exam2pass
0 items Sign In or Register
  • Home
  • IT Exams
  • Guarantee
  • FAQs
  • Reviews
  • Contact Us
  • Demo
Exam2pass > Oracle > Oracle Certifications > 1Z0-809 > 1Z0-809 Online Practice Questions and Answers

1Z0-809 Online Practice Questions and Answers

Questions 4

Given:

public class Emp {

String fName;

String lName;

public Emp (String fn, String ln) {

fName = fn;

lName = ln;

}

public String getfName() { return fName; }

public String getlName() { return lName; }

}

and the code fragment:

List emp = Arrays.asList (

new Emp ("John", "Smith"),

new Emp ("Peter", "Sam"),

new Emp ("Thomas", "Wale"));

emp.stream()

//line n1

.collect(Collectors.toList());

Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and

then ascending order of lName?

A. .sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing(Emp::getlName))

B. .sorted (Comparator.comparing(Emp::getfName).thenComparing(Emp::getlName))

C. .map(Emp::getfName).sorted(Comparator.reserveOrder())

D. .map(Emp::getfName).sorted(Comparator.reserveOrder().map(Emp::getlName).reserved

Buy Now

Correct Answer: B

Questions 5

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.

Buy Now

Correct Answer: D

Questions 6

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

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.

Buy Now

Correct Answer: BD

Questions 7

Given the code fragment:

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

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

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.

Buy Now

Correct Answer: D

Questions 8

Given the code fragment:

Assume that:

The required database driver is configured in the classpath.

The appropriate database is accessible with the dbURL, userName, and passWord exists

The Employee table has a column ID of type integer and the SQL query matches one record.

What is the result?

A. Compilation fails at line 14.

B. Compilation fails at line 15.

C. The code prints the employee ID.

D. The code prints Error.

Buy Now

Correct Answer: A

Questions 9

Given the code fragment:

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

A. Replace line n2 with .map (n -> System.out.println (“New Price” + n –1)) and remove line n3

B. Replace line n2 with .mapToInt (n -> n – 1);

C. Replace line n1 with .forEach (e -> System.out.print (“Price” + e))

D. Replace line n3 with .forEach (n -> System.out.println (“New Price” + n));

Buy Now

Correct Answer: D

Questions 10

Given the records from the STUDENT table:

Given the code fragment:

Assume that the URL, username, and password are valid.

What is the result?

A. The STUDENT table is not updated and the program prints:

114 : John : [email protected]

B. The STUDENT table is updated with the record:

113 : Jannet : [email protected]

and the program prints:

114 : John : [email protected]

C. The STUDENT table is updated with the record:

113 : Jannet : [email protected]

and the program prints:

113 : Jannet : [email protected]

D. A SQLException is thrown at run time.

Buy Now

Correct Answer: D

Questions 11

Given that these files exist and are accessible:

/sports/info.txt

/sports/cricket/players.txt

/sports/cricket/data/ODI.txt

and given the code fragment:

int maxDepth =2;

Stream paths = Files.find(Paths.get("/sports"),

maxDepth,

(p, a) -> p.getFileName().toString().endsWith ("txt"),

FileVisitOption.FOLLOW_LINKS);

Long fCount = paths.count();

System.out.println(fCount);

Assuming that there are NO soft-link/symbolic links to any of the files in the directory structure, what is the

result?

A. 1

B. 2

C. 3

D. An Exception is thrown at runtime.

Buy Now

Correct Answer: D

Questions 12

Given the code fragments:

class Caller implements Callable {

String str;

public Caller (String s) {this.str=s;}

public String call()throws Exception { return str.concat ("Caller");}

}

class Runner implements Runnable {

String str;

public Runner (String s) {this.str=s;}

public void run () { System.out.println (str.concat ("Runner"));}

}

and

public static void main (String[] args) throws InterruptedException, ExecutionException { ExecutorService

es = Executors.newFixedThreadPool(2);

Future f1 = es.submit (new Caller ("Call"));

Future f2 = es.submit (new Runner ("Run"));

String str1 = (String) f1.get();

String str2 = (String) f2.get(); //line n1

System.out.println(str1+ ":" + str2);

}

What is the result?

A. The program prints:

Run Runner

Call Caller : null

And the program does not terminate.

B. The program terminates after printing: Run Runner Call Caller : Run

C. A compilation error occurs at line n1.

D. An Execution is thrown at run time.

Buy Now

Correct Answer: D

Questions 13

Given:

and the code fragment:

Which code fragment can be inserted to print 13?

A. Option A

B. Option B

C. Option C

D. Option D

Buy Now

Correct Answer: B

Exam Code: 1Z0-809
Exam Name: Java SE 8 Programmer II
Last Update: Jun 13, 2025
Questions: 207

PDF (Q&A)

$45.99
ADD TO CART

VCE

$49.99
ADD TO CART

PDF + VCE

$59.99
ADD TO CART

Exam2Pass----The Most Reliable Exam Preparation Assistance

There are tens of thousands of certification exam dumps provided on the internet. And how to choose the most reliable one among them is the first problem one certification candidate should face. Exam2Pass provide a shot cut to pass the exam and get the certification. If you need help on any questions or any Exam2Pass exam PDF and VCE simulators, customer support team is ready to help at any time when required.

Home | Guarantee & Policy |  Privacy & Policy |  Terms & Conditions |  How to buy |  FAQs |  About Us |  Contact Us |  Demo |  Reviews

2025 Copyright @ exam2pass.com All trademarks are the property of their respective vendors. We are not associated with any of them.