Free Oracle 1z0-809 Exam Questions and Answer from Training Expert PassSureExam
Top Oracle 1z0-809 Courses Online
NEW QUESTION # 60
Given:
- A. Compilation fails
- B. A ClassCastException is thrown at runtime
- C. Ym
Xm2 - D. Ym
Xm1
Answer: C
NEW QUESTION # 61
Given the following class:
Which two changes would encapsulate this class and ensure that the area field is always equal to length * height whenever the Rectangle class is used?
- A. Change the area field to public.
- B. Call the setArea method at the end of the setHeight method.
- C. Change the setArea method to private.
- D. Call the setArea method at the beginning of the setHeight method.
- E. Call the setArea method at the beginning of the setLength method.
- F. Call the setArea method at the end of the setLength method.
Answer: A,C
NEW QUESTION # 62
Given the definition of the Emp class:
public class Emp
private String eName;
private Integer eAge;
Emp(String eN, Integer eA) {
this.eName = eN;
this.eAge = eA;
}
public Integer getEAge () {return eAge;}
public String getEName () {return eName;}
}
and code fragment:
List<Emp>li = Arrays.asList(new Emp("Sam", 20), New Emp("John", 60), New Emp ("Jim", 51)); Predicate<Emp> agVal = s -> s.getEAge() > 50; //line n1 li = li.stream().filter(agVal).collect(Collectors.toList()); Stream<String> names = li.stream()map.(Emp::getEName); //line n2 names.forEach(n -> System.out.print(n + " ")); What is the result?
- A. John Jim
- B. A compilation error occurs at line n2.
- C. A compilation error occurs at line n1.
- D. Sam John Jim
Answer: A
NEW QUESTION # 63
Given the code fragment:
What is the result?
- A. The code reads the password without echoing characters on the console.
- B. A compilation error occurs at line n1.
- C. A compilation error occurs at line n2.
- D. A compilation error occurs because the IOException isn't declared to be thrown or caught?
Answer: B
NEW QUESTION # 64
Which two statements are true for a two-dimensional array?
- A. All methods of the class Object may be invoked on the two-dimensional array.
- B. Using a row by column convention, each row of a two-dimensional array must be of the same size.
- C. It is implemented as an array of the specified element type.
- D. At declaration time, the number of elements of the array in each dimension must be specified.
Answer: A,C
NEW QUESTION # 65
Given the code fragment:
public class Foo {
public static void main (String [ ] args) {
Map<Integer, String> unsortMap = new HashMap< > ( );
unsortMap.put (10, “z”);
unsortMap.put (5, “b”);
unsortMap.put (1, “d”);
unsortMap.put (7, “e”);
unsortMap.put (50, “j”);
Map<Integer, String> treeMap = new TreeMap <Integer, String> (new
Comparator<Integer> ( ) {
@Override public int compare (Integer o1, Integer o2) {return
o2.compareTo
(o1); } } );
treeMap.putAll (unsortMap);
for (Map.Entry<Integer, String> entry : treeMap.entrySet () ) {
System.out.print (entry.getValue () + “ “);
}
}
}
What is the result?
- A. j z e b d
- B. z b d e j
- C. d b e z j
- D. A compilation error occurs.
Answer: A
NEW QUESTION # 66
Given:
and the command:
java Product 0
What is the result?
- A. An AssertionError is thrown.
- B. New Price: 0.0
- C. A compilation error occurs at line n1.
- D. A NumberFormatException is thrown at run time.
Answer: B
NEW QUESTION # 67
Given the code fragment:
List<String> colors = Arrays.asList("red", "green", "yellow");
Predicate<String> test = n - > {
System.out.println("Searching...");
return n.contains("red");
};
colors.stream()
. filter(c -> c.length() > 3)
. allMatch(test);
What is the result?
- A. Searching...
Searching...
Searching... - B. Searching...
- C. Searching...
Searching... - D. A compilation error occurs.
Answer: D
NEW QUESTION # 68
Given the code fragment:
Which two code fragments, when inserted at line n1 independently, result in the output PEEK:
Unix?
- A. .findFirst ();
- B. .noneMatch ();
- C. .anyMatch ();
- D. .findAny ();
- E. .allMatch ();
Answer: A
NEW QUESTION # 69
Given the code fragment:
int b = 3;
if ( !(b > 3)) {
System.out.println("square ");
}{
System.out.println("circle ");
}
System.out.println("...");
What is the result?
- A. squarecircle...
- B. square...
- C. Compilation fails.
- D. circle...
Answer: A
NEW QUESTION # 70
Given: What is the result?
- A. Second Exception
- B. First Exception Done
- C. Third Exception
- D. Done Third Exception
- E. 0 Done
Answer: B
NEW QUESTION # 71
Given the code fragment:
Which two modifications, when made independently, enable the code to print Joe:true:100.0?
- A. Option E
- B. Option C
- C. Option B
- D. Option A
- E. Option D
Answer: B,E
Explanation:
A is wrong because "Cannot use this. in a static context"
B is wrong because true is written in capital letters
E is wrong because "The constructor Employee(String, boolean, int) is undefined", there should be a parameterized constructor for class Employee
NEW QUESTION # 72
Given the code fragment:
What is the result?
- A. Logged out at: 2015-01-12T21:58:19.880Z
- B. A compilation error occurs at line n1.
- C. Can't logout
- D. Logged out at: 2015-01-12T21:58:00Z
Answer: D
NEW QUESTION # 73
The following grid shows the state of a 2D array:
This grid is created with the following code:
Which line of code, when inserted in place of //line n1. adds an x into the grid so that the grid contains three consecutive X'S?
- A. qrid [1] [3] = 'X' ;
- B. qrid [0] [2] = 'X' ;
- C. qrid [2] [0] = 'X' ;
- D. qrid [1] [2] = 'X' ;
- E. qrid [3] [1] = 'X' ;
Answer: C
NEW QUESTION # 74
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 27 with:
throw e; - C. Replace line 26 with:
} catch (Exception | ArithmeticException | NumberFormatException e) { - D. Replace line 26 with:
} catch (ArithmeticException | NumberFormatException e) {
Answer: D
NEW QUESTION # 75
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 27 with:
throw e; - C. Replace line 26 with:
} catch (Exception | ArithmeticException | NumberFormatException e) { - D. Replace line 26 with:
} catch (ArithmeticException | NumberFormatException e) {
Answer: D
NEW QUESTION # 76
......
New (2023) Oracle 1z0-809 Exam Dumps: https://passleader.passsureexam.com/1z0-809-pass4sure-exam-dumps.html