Verified 1Z0-809 Preparation 2021
Testking 1Z0-809 Questions are updated and all 1Z0-809 answers are verified by experts. Once you have completely prepared with our 1Z0-809 exam prep kits you will be ready for the real 1Z0-809 exam without a problem. We have Up to date Oracle 1Z0-809 dumps study guide. PASSED 1Z0-809 First attempt! Here What I Did.
Free demo questions for Oracle 1Z0-809 Exam Dumps Below:
NEW QUESTION 1
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()
.f ilter(c -> c.length() > 3)
.allMatch(test); What is the result?
- A. Searching...
- B. Searching...Searching...
- C. Searching...Searching... Searching...
- D. A compilation error occurs.
Answer: A
NEW QUESTION 2
Which action can be used to load a database driver by using JDBC3.0?
- A. Add the driver class to the META-INF/services folder of the JAR file.
- B. Include the JDBC driver class in a jdbc.properties file.
- C. Use the java.lang.Class.forName method to load the driver class.
- D. Use the DriverManager.getDriver method to load the driver class.
Answer: C
NEW QUESTION 3
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;
Answer: C
NEW QUESTION 4
Given:
public final class IceCream { public void prepare() {}
}
public class Cake {
public final void bake(int min, int temp) {} public void mix() {}
}
public class Shop {
private Cake c = new Cake (); private final double discount = 0.25;
public void makeReady () { c.bake(10, 120); }
}
public class Bread extends Cake {
public void bake(int minutes, int temperature) {} public void addToppings() {}
}
Which statement is true?
- A. A compilation error occurs in IceCream.
- B. A compilation error occurs in Cake.
- C. A compilation error occurs in Shop.
- D. A compilation error occurs in Bread
- E. All classes compile successfully.
Answer: D
NEW QUESTION 5
Given the code fragment:
What is the result?
- A. A compilation error occurs at line n1.
- B. Checking…
- C. Checking… Checking…
- D. A compilation error occurs at line n2.
Answer: A
NEW QUESTION 6
Given the code fragment:
public void recDelete (String dirName) throws IOException { File [ ] listOfFiles = new File (dirName) .listFiles();
if (listOfFiles ! = null && listOfFiles.length >0) {
for (File aFile : listOfFiles) { if (aFile.isDirectory ()) {
recDelete (aFile.getAbsolutePath ());
} else {
if (aFile.getName ().endsWith (“.class”)) aFile.delete ();
}
}
}
}
Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.
What is the result?
- A. The method deletes all the .class files in the Projects directory and its subdirectories.
- B. The method deletes the .class files of the Projects directory only.
- C. The method executes and does not make any changes to the Projects directory.
- D. The method throws an IOException.
Answer: A
NEW QUESTION 7
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: C
NEW QUESTION 8
Given the code fragment:
public class FileThread implements Runnable { String fName;
public FileThread(String fName) { this.fName = fName; } public void run () System.out.println(fName);}
public static void main (String[] args) throws IOException, InterruptedException {
ExecutorService executor = Executors.newCachedThreadPool(); Stream<Path> listOfFiles = Files.walk(Paths.get(“Java Projects”)); listOfFiles.forEach(line -> {
executor.execute(new FileThread(line.getFileName().toString ())); //
line n1
});
executor.shutdown(); executor.awaitTermination(5, TimeUnit.DAYS); // line n2
}
}
The Java Projects directory exists and contains a list of files. What is the result?
- A. The program throws a runtime exception at line n2.
- B. The program prints files names concurrently.
- C. The program prints files names sequentially.
- D. A compilation error occurs at line n1.
Answer: B
NEW QUESTION 9
Given:
public class Canvas implements Drawable { public void draw () { }
}
public abstract class Board extends Canvas { }
public class Paper extends Canvas { protected void draw (int color) { }
}
public class Frame extends Canvas implements Drawable { public void resize () { }
}
public interface Drawable { public abstract void draw ();
}
Which statement is true?
- A. Board does not compile.
- B. Paper does not compile.
- C. Frame does not compile.
- D. Drawable does not compile.
- E. All classes compile successfully.
Answer: E
NEW QUESTION 10
Given:
Which option fails?
- A. Foo<String, Integer> mark = new Foo<String, Integer> (“Steve”, 100);
- B. Foo<String, String> pair = Foo.<String>twice (“Hello World!”);
- C. Foo<Object, Object> percentage = new Foo<String, Integer>(“Steve”, 100);
- D. Foo<String, String> grade = new Foo <> (“John”, “A”);
Answer: A
NEW QUESTION 11
Given the code fragment:
public static void main (String[] args) throws IOException { BufferedReader brCopy = null;
try (BufferedReader br = new BufferedReader (new FileReader(“employee.txt”)))
{ // line n1
br.lines().forEach(c -> System.out.println(c)); brCopy = br; //line n2
}
brCopy.ready(); //line n3;
}
Assume that the ready method of the BufferedReader, when called on a closed BufferedReader, throws an exception, and employee.txt is accessible and contains valid text.
What is the result?
- A. A compilation error occurs at line n3.
- B. A compilation error occurs at line n1.
- C. A compilation error occurs at line n2.
- D. The code prints the content of the employee.txt file and throws an exception at line n3.
Answer: D
NEW QUESTION 12
Given:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { } and the code fragment:
class App {
public void doRegister(String name, int age) throws UserException, AgeOutOfLimitException { if (name.length () < 6) {
throw new UserException ();
} else if (age >= 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println(“User is registered.”);
}
}
public static void main(String[ ] args) throws UserException { App t = new App ();
- A. t.d oRegister(“Mathew”, 60);}}What is the result?
- B. User is registered.
- C. An AgeOutOfLimitException is thrown.
- D. A UserException is thrown.
- E. A compilation error occurs in the main method.
Answer: B
NEW QUESTION 13
Given the code fragment:
class CallerThread implements Callable<String> { String str;
public CallerThread(String s) {this.str=s;} public String call() throws Exception { return str.concat(“Call”);
}
}
and
public static void main (String[] args) throws InterruptedException, ExecutionException
{
ExecutorService es = Executors.newFixedThreadPool(4); //line n1 Future f1 = es.submit (newCallerThread(“Call”));
String str = f1.get().toString(); System.out.println(str);
}
Which statement is true?
- A. The program prints Call Call and terminates.
- B. The program prints Call Call and does not terminate.
- C. A compilation error occurs at line n1.
- D. An ExecutionException is thrown at run time.
Answer: B
NEW QUESTION 14
Given the code fragment:
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14); LocalDate nextYear = valentinesDay.plusYears(1); nextYear.plusDays(15); //line n1
System.out.println(nextYear); What is the result?
- A. 2021-02-14
- B. A DateTimeException is throw
- C. 2021-02-29
- D. A compilation error occurs at line n1.
Answer: A
NEW QUESTION 15
Given:
and the code fragment:
What is the result?
- A. A compilation error occurs at line n1.
- B. An Exception is thrown at run time.
- C. 2
Answer: B
NEW QUESTION 16
and the code fragment?
What is the result?
- A. $15.00
- B. 15 $
- C. USD 15.00
- D. USD $15
Answer: A
NEW QUESTION 17
In 2015, daylight saving time in New York, USA, begins on March 8th at 2:00 AM. As a result, 2:00 AM becomes 3:00 AM.
Given the code fragment:
Which is the result?
- A. 3:00 – difference: 2
- B. 2:00 – difference: 1
- C. 4:00 – difference: 3
- D. 4:00 – difference: 2
Answer: B
NEW QUESTION 18
Given the content of /resourses/Message.properties: welcome1=”Good day!”
and given the code fragment: Properties prop = new Properties ();
FileInputStream fis = new FileInputStream (“/resources/Message.properties”); prop.load(fis);
System.out.println(prop.getProperty(“welcome1”)); System.out.println(prop.getProperty(“welcome2”, “Test”));//line n1 System.out.println(prop.getProperty(“welcome3”));
What is the result?
- A. Good day!Testfollowed by an Exception stack trace
- B. Good day!followed by an Exception stack trace
- C. Good day!Test null
- D. A compilation error occurs at line n1.
Answer: C
NEW QUESTION 19
Given the code fragment:
What is the result?
- A. A compilation error occurs at line n1.
- B. courseJava
- C. Javacourse
- D. A compilation error occurs at line n2.
Answer: A
NEW QUESTION 20
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?
- A. Rate of interest: 0
- B. An AssertionError is thrown.
- C. No interest for this account
- D. A compilation error occurs at line n1.
Answer: B
NEW QUESTION 21
Given the definition of the Vehicle class:
Class Vehhicle {
int distance; //line n1 Vehicle (int x) {
this distance = x;
}
public void increSpeed(int time) { //line n2 int timeTravel = time; //line n3
class Car { int value = 0;
public void speed () {
value = distance /timeTravel;
System.out.println (“Velocity with new speed”+value+”kmph”);
}
}
new Car().speed();
}
}
and this code fragment: Vehicle v = new Vehicle (100); v.increSpeed(60);
What is the result?
- A. Velocity with new speed
- B. A compilation error occurs at line n1.
- C. A compilation error occurs at line n2.
- D. A compilation error occurs at line n3.
Answer: A
NEW QUESTION 22
Given the code fragments:
and
What is the result?
- A. The program prints Run… and throws an exception.
- B. A compilation error occurs at line n1.
- C. Run…Call…
- D. A compilation error occurs at line n2.
Answer: B
NEW QUESTION 23
The data.doc, data.txt and data.xml files are accessible and contain text. Given the code fragment:
Stream<Path> paths = Stream.of (Paths. get(“data.doc”),
Paths. get(“data.txt”),
Paths. get(“data.xml”));
paths.filter(s-> s.toString().endWith(“txt”)).forEach( s -> {
try { Files.readAllLines(s)
.stream()
.f orEach(System.out::println); //line n1
} catch (IOException e) { System.out.println(“Exception”);
}
}
);
What is the result?
- A. The program prints the content of data.txt file.
- B. The program prints: Exception<<The content of the data.txt file>> Exception
- C. A compilation error occurs at line n1.
- D. The program prints the content of the three files.
Answer: A
NEW QUESTION 24
Given:
IntStream stream = IntStream.of (1,2,3); IntFunction<Integer> inFu= x -> y -> x*y; //line n1
IntStream newStream = stream.map(inFu.apply(10)); //line n2 newStream.forEach(System.output::print);
Which modification enables the code fragment to compile?
- A. Replace line n1 with: IntFunction<UnaryOperator> inFu = x -> y -> x*y;
- B. Replace line n1 with: IntFunction<IntUnaryOperator> inFu = x -> y -> x*y;
- C. Replace line n1 with: BiFunction<IntUnaryOperator> inFu = x -> y -> x*y;
- D. Replace line n2 with:IntStream newStream = stream.map(inFu.applyAsInt (10));
Answer: B
NEW QUESTION 25
......
Thanks for reading the newest 1Z0-809 exam dumps! We recommend you to try the PREMIUM prep-labs.com 1Z0-809 dumps in VCE and PDF here: https://www.prep-labs.com/dumps/1Z0-809/ (164 Q&As Dumps)