Summer Special - Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: top65certs

Oracle 1z0-809 Online Access

Page: 8 / 16
Total 208 questions

Java SE 8 Programmer II Questions and Answers

Question 29

Given that data.txt and alldata.txt are accessible, and the code fragment:

What is required at line n1 to enable the code to overwrite alldata.txt with data.txt?

Options:

A.

br.close();

B.

bw.writeln();

C.

br.flush();

D.

bw.flush();

Question 30

Given:

and the code fragment:

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.

Question 31

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

Options:

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.

Question 32

Given the structure of the Student table:

Student (id INTEGER, name VARCHAR)

Given the records from the STUDENT table:

Given the code fragment:

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.

Page: 8 / 16
Total 208 questions