1Z0-851 Exam Details

  • Exam Code
    :1Z0-851
  • Exam Name
    :Oracle Solaris 11 System Administration
  • Certification
    :Oracle Certifications
  • Vendor
    :Oracle
  • Total Questions
    :290 Q&As
  • Last Updated
    :Dec 10, 2021

Oracle 1Z0-851 Online Questions & Answers

  • Question 161:

    Given:

    11.

    public static void parse(String str) {

    12.

    try {

    13.

    float f = Float.parseFloat(str);

    14.

    } catch (NumberFormatException nfe) {

    15.

    f = 0;

    16.

    } finally {

    17.

    System.out.println(f);

    18.

    }

    19.

    }

    20.

    public static void main(String[] args) {

    21.

    parse("invalid");

    22.

    }

    What is the result?

    A. 0.0
    B. Compilation fails.
    C. A ParseException is thrown by the parse method at runtime.
    D. A NumberFormatException is thrown by the parse method at runtime.

  • Question 162:

    Given:

    1.

    import java.util.*;

    2.

    public class Example {

    3.

    public static void main(String[] args) {

    4.

    // insert code here

    5.

    set.add(new Integer(2));

    6.

    set.add(new Integer(1));

    7.

    System.out.println(set);

    8.

    }

    9.

    }

    Which code, inserted at line 4, guarantees that this program will output [1, 2]?

    A. Set set = new TreeSet();
    B. Set set = new HashSet();
    C. Set set = new SortedSet();
    D. List set = new SortedList();
    E. Set set = new LinkedHashSet();

  • Question 163:

    Given:

    11.

    static class A {

    12.

    void process() throws Exception { throw new Exception(); }

    13.

    }

    14.

    static class B extends A {

    15.

    void process() { System.out.println("B"); }

    16.

    }

    17.

    public static void main(String[] args) {

    18.

    new B().process();

    19.

    }

    What is the result?

    A. B
    B. The code runs with no output.
    C. Compilation fails because of an error in line 12.
    D. Compilation fails because of an error in line 15.
    E. Compilation fails because of an error in line 18.

  • Question 164:

    Click the Exhibit button. Given:

    25.

    try {

    26.

    A a = new A();

    27.

    a.method1();

    28.

    } catch (Exception e) {

    29.

    System.out.print("an error occurred");

    30.

    }

    Which two statements are true if a NullPointerException is thrown on line 3 of class C? (Choose two.)

    A. The application will crash.
    B. The code on line 29 will be executed.
    C. The code on line 5 of class A will execute.
    D. The code on line 5 of class B will execute.
    E. The exception will be propagated back to line 27.

  • Question 165:

    Which statement is true?

    A. A class's finalize() method CANNOT be invoked explicitly.
    B. super.finalize() is called implicitly by any overriding finalize() method.
    C. The finalize() method for a given object is called no more than once by the garbage collector.
    D. The order in which finalize() is called on two objects is based on the order in which the two objects became finalizable.

  • Question 166:

    Given:

    1.

    public class Donkey {

    2.

    public static void main(String[] args) {

    3.

    boolean assertsOn = false;

    4.

    assert (assertsOn) : assertsOn = true;

    5.

    if(assertsOn) {

    6.

    System.out.println("assert is on");

    7.

    }

    8.

    }

    9.

    }

    If class Donkey is invoked twice, the first time without assertions enabled, and the second time with assertions enabled, what are the results?

    A. no output
    B. no output assert is on
    C. assert is on
    D. no output An AssertionError is thrown.
    E. assert is on An AssertionError is thrown.

  • Question 167:

    Given:

    3.

    interface Fish { }

    4.

    class Perch implements Fish { }

    5.

    class Walleye extends Perch { }

    6.

    class Bluegill { }

    7.

    public class Fisherman {

    8.

    public static void main(String[] args) {

    9.

    Fish f = new Walleye();

    10.

    Walleye w = new Walleye();

    11.

    Bluegill b = new Bluegill();

    12.

    if(f instanceof Perch) System.out.print("f-p ");

    13.

    if(w instanceof Fish) System.out.print("w-f ");

    14.

    if(b instanceof Fish) System.out.print("b-f ");

    15.

    }

    16.

    }

    What is the result?

    A. w-f
    B. f-p w-f
    C. w-f b-f
    D. f-p w-f b-f
    E. Compilation fails.
    F. An exception is thrown at runtime.

  • Question 168:

    Given:

    1.

    public class Drink implements Comparable {

    2.

    public String name;

    3.

    public int compareTo(Object o) {

    4.

    return 0;

    5.

    }

    6.

    }

    and:

    20.

    Drink one = new Drink();

    21.

    Drink two = new Drink();

    22.

    one.name= "Coffee";

    23.

    two.name= "Tea";

    24.

    TreeSet set = new TreeSet();

    25.

    set.add(one);

    26.

    set.add(two);

    A programmer iterates over the TreeSet and prints the name of each Drink object.

    What is the result?

    A. Tea
    B. Coffee
    C. Coffee Tea
    D. Compilation fails.
    E. The code runs with no output.
    F. An exception is thrown at runtime.

  • Question 169:

    Given:

    10.

    class One {

    11.

    void foo() { }

    12.

    }

    13.

    class Two extends One {

    14.

    //insert method here

    15.

    }

    Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.)

    A. int foo() { /* more code here */ }
    B. void foo() { /* more code here */ }
    C. public void foo() { /* more code here */ }
    D. private void foo() { /* more code here */ }
    E. protected void foo() { /* more code here */ }

  • Question 170:

    Given:

    1.

    interface TestA { String toString(); }

    2.

    public class Test {

    3.

    public static void main(String[] args) {

    4.

    System.out.println(new TestA() {

    5.

    public String toString() { return "test"; }

    6.

    });

    7.

    }

    8.

    }

    What is the result?

    A. test
    B. null
    C. An exception is thrown at runtime.
    D. Compilation fails because of an error in line 1.
    E. Compilation fails because of an error in line 4.
    F. Compilation fails because of an error in line 5.

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-851 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.