1Z0-805 Exam Details

  • Exam Code
    :1Z0-805
  • Exam Name
    :Upgrade to Java SE 7 Programmer
  • Certification
    :Oracle Certifications
  • Vendor
    :Oracle
  • Total Questions
    :90 Q&As
  • Last Updated
    :Dec 09, 2021

Oracle 1Z0-805 Online Questions & Answers

  • Question 41:

    Given the following incorrect program:

    class MyTask extends RecursiveTask {

    final int low;

    final int high;

    static final int THRESHOLD = /* . . . */

    MyTask (int low, int high) { this.low = low; this.high = high; }

    Integer computeDirectly()/* . . . */

    protected void compute() {

    if (high ?low<;= THRESHOLD)

    return computeDirectly();

    int mid = (low + high) / 2;

    invokeAll(new MyTask(low, mid), new MyTask(mid, high));

    Which two changes make the program work correctly?

    A. Results must be retrieved from the newly created MyTask Instances and combined.
    B. The THRESHOLD value must be increased so that the overhead of task creation does not dominate the cost of computation.
    C. The midpoint computation must be altered so that it splits the workload in an optimal manner.
    D. The compute () method must be changed to return an Integer result.
    E. The computeDirectly () method must be enhanced to fork () newly created tasks.
    F. The MyTask class must be modified to extend RecursiveAction instead of RecursiveTask.

  • Question 42:

    Given the code fragment: static void addContent () throws Exception {

    Path path = Paths.get("D:\\company\\report.txt");

    UserPrincipal owner = path.getFileSystem().getUserPrincipalLookupService().lookupPrincipalByName("Bob");

    Files.setOwner(path, owner);

    // insert code here ?Line **

    br.write("this is a text message ");

    }

    System.out.println("success");

    }

    Assume that the report.txt file exists.

    Which try statement, when inserted at line **, enables appending the file content without writing the metadata to the underlying disk?

    A. try (BufferWriter br = Files.newBufferedWriter (path, Charset.forName ("UTF-8"), new openOption [] {StandardOpenOption.CREATE, StandardOpenOption.Append, StandardOpenOption.DSYNC}};} {
    B. try (BufferWriter br = Files.newBufferedWriter (path, Charset.forName ("UTF-8"), new openOption [] {StandardOpenOption.APPEND, StandardOpenOption.SYNC));){
    C. try (BufferWriter br = Files.newBufferedWriter (path, Charset.forName ("UTF - 8"), new openOption [] {StandardOpenOption.APPEND, StandardOpenOption.DSYNC}
    D. try (BufferWriter br = Files.newBufferedWriter (path, Charset.forName ("UTF?;), new openOption [] {StandardOpenOption.CREATENEW, StandardOpenOption.APPEND, StandardOpenOption.SYNC}} }
    E. try (BufferWriter br = Files.newBufferedWriter (path, Charset.forName ("UTF - 8"), new openOption [] {StandardOpenOption.APPEND, StandardOpenOption.ASYNC});) {

  • Question 43:

    import java.util.*;

    public class StringApp {

    public static void main (String [] args)

    { Set set = new TreeSet <> ();

    set.add("X");

    set.add("Y");

    set.add("X");

    set.add("Y");

    set.add("X");

    Iterator it = set.iterator ();

    int count = 0;

    while (it.hasNext())

    { switch

    (it.next()){ case "X":

    System.out.print("X ");

    break; case "Y":

    System.out.print("Y ");

    break;

    }

    count++;

    }

    System.out.println ("\ncount = " + count);

    }

    }

    A. X X Y X Y count = 5
    B. X Y X Y count = 4
    C. X Y count = s
    D. X Y count = 2

  • Question 44:

    You are using a database from XY/Data. What is a prerequisite for connecting to the database using a JDBC 4.0 driver from XY/Data?

    A. Use the JDBC DriverManager.loadDriver method.
    B. Put the XY/data driver into the classpath of your application.
    C. Create an instance of the XY/Data driver class using the new keyword.
    D. Create an Implementation of DriverManager that extends the XY/Data driver

  • Question 45:

    Two companies with similar robots have merged. You are asked to construct a new program that allows the features of the robots to be mixed and matched using composition. Given the code fragments:

    public class CrusherRobot {

    public void walk () {}

    public void positionArm (int x, int y, int z) {}

    public void raiseHammer() {}

    public void dropHammer() {}

    }

    public class GripperRobot {

    public void walk() {}

    public void moveArm (int x, int y, int z) {}

    public void openGripper () {}

    public void closeGripper() {}

    }

    When applying composition to these two classes, what functionality should you extract into a new class?

    A. A new BasicRobot class that provides walking.
    B. A new BasicRobot class that combines gripping and hammering.
    C. A new BasicRobotFactory class to construct instances of GripperRobot.
    D. A new BasicRobotFactory class to construct instances of CrusherRobot.

  • Question 46:

    Given: Which design pattern moves the getPerson, createPerson, deletePerson, and updatePerson methods to a new class?

    A. Singleton
    B. DAO
    C. Factory
    D. Composition

  • Question 47:

    Given the code fragment:

    try {

    String query = "SELECT * FROM Employee WHERE ID=110";

    Statement stmt = conn.createStatement();

    ResultSet rs = stmt.executeQuery(query); // Line 13

    System.out.println("Employee ID: " + rs.getInt("ID")); // Line 14

    } catch (Exception se)

    { System.out.println("Error"

    );

    }

    Assume that the SQL query matches one record. What is the result of compiling and executing this code?

    A. The code prints error.
    B. The code prints the employee ID.
    C. Compilation fails due to an error at line 13.
    D. Compilation fails due to an error at line 14.

  • Question 48:

    Given the code fragment:

    Locale loc1 = Locale.getDefault ();

    ResourceBundle messages = ResourceBundle.getBundle("MessageBundle", loc1);

    Which two statements are a valid way to re-assign a resource bundle to a different Locale?

    A. loc1 = ResourceBundle.getBundle ("MessageBundle", Locale.CHINA);
    B. loc1 = ResourceBundle.getBundle ("MessageBundle", new Locale ("es", "ES"));
    C. messages = ResourceBundle.getBundle ("messageBundle", new Locale ("es", "ES"));
    D. messages = ResourceBundle.getBundle ("MessageBundle", Locale.CHINA);

  • Question 49:

    What statement is true about thread starvation?

    A. Thread "A" is said to be starved when it is frequently unable to gain access to a resource that it shares with another thread.
    B. Thread "A" is said to be starved when it is blocked waiting for Thread "13," which in turn waiting for Thread "A."
    C. Starvation can occur when threads become so busy responding to other threads that they move forward with their other work.
    D. When some of the processors in a multi-processor environment go offline and the live thread(s) blocked waiting for CPU cycles, that blocking is referred to as "thread starvation."

  • Question 50:

    Given:

    public class TemperatureSensor {

    public TemperatureSensor () {

    }

    public double getCurrTemp () {

    // . . . method to retrieve temperature from a sensor

    Return temp;

    }

    }

    Which three changes should you make to apply the singleton design pattern to this class?

    A. Make the class abstract.
    B. Add a method to return a singleton class type.
    C. Change the access of the constructor to private.
    D. Add a public constructor that takes a single argument.
    E. Change the class to implement the singleton interface.
    F. Add a private static final variable that is initialized to new TemperatureSensor{};
    G. Add a public static method that returns the class variable of type

Tips on How to Prepare for the Exams

Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Oracle exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your 1Z0-805 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.