Black Friday Special 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: bestdeal

How to Pass the Oracle 1z0-809 Exam: Comprehensive Java SE 8 Programmer II Guide and Tips

Questions 11

Given:

class RateOfInterest {

public static void main (String[] args) {

int rateOfInterest = 0;

String accountType = “LOAN”;

switch (accountType) {

case “RD”;

rateOfInterest = 5;

break;

case “FD”;

rateOfInterest = 10;

break;

default:

assert false: “No interest for this account”; //line n1

}

System.out.println (“Rate of interest:” + rateOfInterest);

}

}

and the command:

java –ea RateOfInterest

What is the result?

Options:

A.

Rate of interest: 0

B.

An AssertionError is thrown.

C.

No interest for this account

D.

A compilation error occurs at line n1.

Buy Now
Questions 12

For which three objects must a vendor provide implementations in its JDBC driver? (Choose three.)

Options:

A.

Time

B.

Date

C.

Statement

D.

ResultSet

E.

Connection

F.

SQLException

G.

DriverManager

Buy Now
Questions 13

Given:

1z0-809 Question 13

and the code fragment:

1z0-809 Question 13

What is the result?

Options:

A.

[Java EE: Helen:Houston][Java ME: Jessy:Chicago, Java ME: Mark:Chicago]

B.

Java EEJava ME

C.

[Java ME: Jessy:Chicago, Java ME: Mark:Chicago][Java EE: Helen:Houston]

D.

A compilation error occurs.

Buy Now
Questions 14

Given:

class Worker extends Thread {

CyclicBarrier cb;

public Worker(CyclicBarrier cb) { this.cb = cb; }

public void run () {

try {

cb.await();

System.out.println(“Worker…”);

} catch (Exception ex) { }

}

}

class Master implements Runnable { //line n1

public void run () {

System.out.println(“Master…”);

}

}

and the code fragment:

Master master = new Master();

//line n2

Worker worker = new Worker(cb);

worker.start();

You have been asked to ensure that the run methods of both the Worker and Master classes are executed.

Which modification meets the requirement?

Options:

A.

At line n2, insert CyclicBarrier cb = new CyclicBarrier(2, master);

B.

Replace line n1 with class Master extends Thread {

C.

At line n2, insert CyclicBarrier cb = new CyclicBarrier(1, master);

D.

At line n2, insert CyclicBarrier cb = new CyclicBarrier(master);

Buy Now
Questions 15

Given the structure of the Student table:

Student (id INTEGER, name VARCHAR)

Given the records from the STUDENT table:

1z0-809 Question 15

Given the code fragment:

1z0-809 Question 15

Assume that:

What is the result?

Options:

A.

The program prints Status: true and two records are deleted from the Student table.

B.

The program prints Status: false and two records are deleted from the Student table.

C.

A SQLException is thrown at runtime.

D.

The program prints Status: false but the records from the Student table are not deleted.

Buy Now
Questions 16

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? (Choose two.)

Options:

A.

Replace line n1 with:class Folder implements AutoCloseable {

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

Buy Now
Questions 17

Given:

1z0-809 Question 17

and the code fragment:

1z0-809 Question 17

What is the result?

Options:

A.

An exception is thrown at line n2.

B.

100

C.

A compilation error occurs because the try block is declared without a catch or finally block.

D.

A compilation error occurs at line n1.

Buy Now
Questions 18

Given:

public class Test {

private T t;

public T get () {

return t;

}

public void set (T t) {

this.t = t;

}

public static void main (String args [ ] ) {

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

Options:

A.

Java 100

B.

java.lang.string@<hashcode>java.lang.Integer@<hashcode>

C.

A compilation error occurs. To rectify it, replace line n1 with:Test type1 = new Test<>();

D.

A compilation error occurs. To rectify it, replace line n2 with:type1.set (Integer(100));

Buy Now
Questions 19

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

Options:

A.

The program prints:Run RunnerCall Caller : nullAnd the program does not terminate.

B.

The program terminates after printing:Run RunnerCall Caller : Run

C.

A compilation error occurs at line n1.

D.

An Execution is thrown at run time.

Buy Now
Questions 20

Which two statements are true about synchronization and locks? (Choose two.)

Options:

A.

A thread automatically acquires the intrinsic lock on a synchronized statement when executed.

B.

The intrinsic lock will be retained by a thread if return from a synchronized method is caused by an uncaught exception.

C.

A thread exclusively owns the intrinsic lock of an object between the time it acquires the lock and the time it releases it.

D.

A thread automatically acquires the intrinsic lock on a synchronized method’s object when entering that method.

E.

Threads cannot acquire intrinsic locks on classes.

Buy Now
Exam Code: 1z0-809
Exam Name: Java SE 8 Programmer II
Last Update: Dec 13, 2024
Questions: 196

PDF + Testing Engine

$164.99
$66

Testing Engine

$124.99
$50

PDF (Q&A)

$104.99
$42