Leads4pass > Oracle > Oracle Certifications > 1Z0-809 > 1Z0-809 Online Practice Questions and Answers

1Z0-809 Online Practice Questions and Answers

Questions 4

Given:

class Sum extends RecursiveAction { //line n1

static final int THRESHOLD_SIZE = 3;

int stIndex, lstIndex;

int [ ] data;

public Sum (int [ ]data, int start, int end) {

this.data = data;

this stIndex = start;

this. lstIndex = end;

}

protected void compute ( ) {

int sum = 0;

if (lstIndex ?stIndex<;= THRESHOLD_SIZE) {

for (int i = stIndex; i < lstIndex; i++) {

sum += data [i];

}

System.out.println(sum);

} else {

new Sum (data, stIndex + THRESHOLD_SIZE, lstIndex).fork( );

new Sum (data, stIndex,

Math.min (lstIndex, stIndex + THRESHOLD_SIZE)

).compute ();

}

}

}

and the code fragment:

ForkJoinPool fjPool = new ForkJoinPool ( );

int data [ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

fjPool.invoke (new Sum (data, 0, data.length));

and given that the sum of all integers from 1 to 10 is 55.

Which statement is true?

A. The program prints several values that total 55.

B. The program prints 55.

C. A compilation error occurs at line n1.

D. The program prints several values whose sum exceeds 55.

Buy Now
Questions 5

Given the code fragment:

Path file = Paths.get ("courses.txt"); // line n1

Assume the courses.txt is accessible.

Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file?

A. List fc = Files.list(file); fc.stream().forEach (s - > System.out.println(s));

B. Stream fc = Files.readAllLines (file); fc.forEach (s - > System.out.println(s));

C. List fc = readAllLines(file); fc.stream().forEach (s - > System.out.println(s));

D. Stream fc = Files.lines (file); fc.forEach (s - > System.out.println(s));

Buy Now
Questions 6

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. Comment the lines 28, 29 and 30.

B. Replace line 26 with: } catch (Exception | ArithmeticException | NumberFormatException e) {

C. Replace line 26 with: } catch (ArithmeticException | NumberFormatException e) {

D. Replace line 27 with: throw e;

Buy Now
Questions 7

Given:

class Student {

String course, name, city;

public Student (String name, String course, String city) {

this.course = course; this.name = name; this.city = city;

}

public String toString() {

return course + ":" + name + ":" + city;

}

and the code fragment:

List stds = Arrays.asList(

new Student ("Jessy", "Java ME", "Chicago"),

new Student ("Helen", "Java EE", "Houston"),

new Student ("Mark", "Java ME", "Chicago"));

stds.stream()

.collect(Collectors.groupingBy(Student::getCourse))

.forEach(src, res) -> System.out.println(scr));

What is the result?

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

B. Java EE Java ME

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

D. A compilation error occurs.

Buy Now
Questions 8

Given:

public enum USCurrency {

PENNY (1),

NICKLE(5),

DIME (10),

QUARTER(25);

private int value;

public USCurrency(int value) {

this.value = value;

}

public int getValue() {return value;}

}

public class Coin {

public static void main (String[] args) {

USCurrency usCoin =new USCurrency.DIME;

System.out.println(usCoin.getValue()):

}

}

Which two modifications enable the given code to compile? (Choose two.)

A. Nest the USCurrency enumeration declaration within the Coin class.

B. Make the USCurrency enumeration constructor private.

C. Remove the new keyword from the instantion of usCoin.

D. Make the getter method of value as a static method.

E. Add the final keyword in the declaration of value.

Buy Now
Questions 9

Which statement is true about the DriverManager class?

A. It returns an instance of Connection.

B. it executes SQL statements against the database.

C. It only queries metadata of the database.

D. it is written by different vendors for their specific database.

Buy Now
Questions 10

Which two statements are true about localizing an application? (Choose two.)

A. Support for new regional languages does not require recompilation of the code.

B. Textual elements (messages and GUI labels) are hard-coded in the code.

C. Language and region-specific programs are created using localized data.

D. Resource bundle files include data and currency information.

E. Language codes use lowercase letters and region codes use uppercase letters.

Buy Now
Questions 11

Given the code fragment:

List codes = Arrays.asList ("DOC", "MPEG", "JPEG");

codes.forEach (c -> System.out.print(c + " "));

String fmt = codes.stream()

.filter (s-> s.contains ("PEG"))

.reduce((s, t) -> s + t).get();

System.out.println("\n" + fmt);

What is the result?

A. DOC MPEG JPEG MPEGJPEG

B. DOC MPEG MPEGJPEG MPEGMPEGJPEG

C. MPEGJPEG MPEGJPEG

D. The order of the output is unpredictable.

Buy Now
Questions 12

Given that /green.txt and /colors/yellow.txt are accessible, and the code fragment:

Path source = Paths.get("/green.txt);

Path target = Paths.get("/colors/yellow.txt);

Files.move(source, target, StandardCopyOption.ATOMIC_MOVE);

Files.delete(source);

Which statement is true?

A. The green.txt file content is replaced by the yellow.txt file content and the yellow.txt file is deleted.

B. The yellow.txt file content is replaced by the green.txt file content and an exception is thrown.

C. The file green.txt is moved to the /colors directory.

D. A FileAlreadyExistsException is thrown at runtime.

Buy Now
Questions 13

Given:

and this code fragment:

What is the result?

A. Open-Close– Exception – 1 Open–Close–

B. Open–Close–Open–Close–

C. A compilation error occurs at line n1.

D. Open–Close–Open–

Buy Now
Exam Code: 1Z0-809
Exam Name: Java SE 8 Programmer II
Last Update: Jun 17, 2026
Questions: 207
10%OFF Coupon Code: SAVE10

PDF (Q&A)

$49.99

VCE

$55.99

PDF + VCE

$65.99