1Z0-809 | What Real 1Z0-809 dumps Is?


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

Answer:

Q42. Which statement is true about the single abstract method of the java.util.function.Function interface? 

A. It accepts one argument and returns void. 

B. It accepts one argument and returns boolean. 

C. It accepts one argument and always produces a result of the same type as the argument. 

D. It accepts an argument and produces a result of any data type. 

Answer:

Reference: http://winterbe.com/posts/2014/03/16/java-8-tutorial/ (functions) 

Q43. Given the code fragment: 

Path path1 = Paths.get(“/app/./sys/”); 

Path res1 = path1.resolve(“log”); 

Path path2 = Paths.get(“/server/exe/”); 

Path res1 = path1.resolve(“/readme/”); 

System.out.println(res1); 

System.out.println(res2); 

What is the result? 

A. /app/sys/log /readme/server/exe 

B. /app/log/sys /server/exe/readme 

C. /app/./sys/log /readme 

D. /app/./sys/log /server/exe/readme 

Answer:

Q44. Given: 

What is the result? 

A. 6 7 8 

B. 7 8 9 

C. 0 1 2 

D. 6 8 10 

E. Compilation fails 

Answer:

Q45. Given the code fragment: 

Which code fragment prints blue, cyan, ? A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q46. Given: 

A. Ym Xm2 

B. Ym Xm1 

C. Compilation fails 

D. A ClassCastException is thrown at runtime 

Answer:

Q47. Given: What is the result? 

A. hEllOjAvA! 

B. Hello java! 

C. Out of limits hEllOjAvA! 

D. Out of limits 

Answer:

Q48. Given the code fragment: 

Stream<List<String>> iStr= Stream.of ( Arrays.asList (“1”, “John”), 

Arrays.asList (“2”, null)0; 

Stream<<String> nInSt = iStr.flatMapToInt ((x) -> x.stream ()); 

nInSt.forEach (System.out :: print); 

What is the result? 

A. 1John2null 

B. 12 

C. A NullPointerException is thrown at run time. 

D. A compilation error occurs. 

Answer:

Q49. Given the code fragment: 

List<String> nL = Arrays.asList(“Jim”, “John”, “Jeff”); 

Function<String, String> funVal = s -> “Hello : “.contact(s); 

nL.Stream() 

.map(funVal) 

.peek(System.out::print); 

What is the result? 

A. Hello : Jim Hello : John Hello : Jeff 

B. Jim John Jeff 

C. The program prints nothing. 

D. A compilation error occurs. 

Answer:

Q50. Given: What is the result? 

A. The program prints nothing 

B. d 

C. A StringIndexOutOfBoundsException is thrown at runtime. 

D. AnArrayIndexOutOfBoundsException is thrown at runtime. 

E. A NullPointerException is thrown at runtime. 

Answer: