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 201:

    Given:

    11.

    class Animal { public String noise() { return "peep"; } }

    12.

    class Dog extends Animal {

    13.

    public String noise() { return "bark"; }

    14.

    }

    15.

    class Cat extends Animal {

    16.

    public String noise() { return "meow"; }

    17.

    } ...

    30.

    Animal animal = new Dog();

    31.

    Cat cat = (Cat)animal;

    32.

    System.out.println(cat.noise());

    What is the result?

    A. peep
    B. bark
    C. meow
    D. Compilation fails.
    E. An exception is thrown at runtime.

  • Question 202:

    Click the Exhibit button. Given:

    31.

    public void method() {

    32.

    A a = new A();

    33.

    a.method1();

    34.

    }

    Which statement is true if a TestException is thrown on line 3 of class B?

    A. Line 33 must be called within a try block.
    B. The exception thrown by method1 in class A is not required to be caught.
    C. The method declared on line 31 must be declared to throw a RuntimeException.
    D. On line 5 of class A, the call to method2 of class B does not need to be placed in a try/catch block.

  • Question 203:

    Given:

    1.

    package com.company.application;

    2.

    3.

    public class MainClass {

    4.

    public static void main(String[] args) {}

    5.

    }

    And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to "." (current directory).

    Which two java commands entered at the command line will run MainClass? (Choose two.)

    A. java MainClass if run from the /apps directory
    B. java com.company.application.MainClass if run from the /apps directory
    C. java -classpath /apps com.company.application.MainClass if run from any directory
    D. java -classpath . MainClass if run from the /apps/com/company/application directory
    E. java -classpath /apps/com/company/application:. MainClass if run from the /apps directory
    F. java com.company.application.MainClass if run from the /apps/com/company/application directory

  • Question 204:

    Given:

    1.

    public class TestString3 {

    2.

    public static void main(String[] args) {

    3.

    // insert code here

    5.

    System.out.println(s);

    6.

    }

    7.

    }

    Which two code fragments, inserted independently at line 3, generate the output 4247? (Choose two.)

    A. String s = "123456789"; s = (s-"123").replace(1,3,"24") - "89";
    B. StringBuffer s = new StringBuffer("123456789");
    C. delete(0,3).replace(1,3,"24").delete(4,6);
    D. StringBuffer s = new StringBuffer("123456789");
    E. substring(3,6).delete(1,3).insert(1, "24");
    F. StringBuilder s = new StringBuilder("123456789");
    G. substring(3,6).delete(1,2).insert(1, "24");
    H. StringBuilder s = new StringBuilder("123456789");
    I. delete(0,3).delete(1,3).delete(2,5).insert(1, "24");

  • Question 205:

    Select and Place:

  • Question 206:

    Given:

    1.

    public class TestFive {

    2.

    private int x;

    3.

    public void foo() {

    4.

    int current = x;

    5.

    x = current + 1;

    6.

    }

    7.

    public void go() {

    8.

    for(int i = 0; i < 5; i++) {

    9.

    new Thread() {

    10.

    public void run() {

    11.

    foo();

    12.

    System.out.print(x + ", ");

    13.

    } }.start();

    14.

    } }

    Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ? (Choose two.)

    A. move the line 12 print statement into the foo() method
    B. change line 7 to public synchronized void go() {
    C. change the variable declaration on line 2 to private volatile int x;
    D. wrap the code inside the foo() method with a synchronized( this ) block
    E. wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }

  • Question 207:

    Which two code fragments are most likely to cause a StackOverflowError? (Choose two.)

    A. int []x = {1,2,3,4,5}; for(int y = 0; y < 6; y++) System.out.println(x[y]);
    B. static int[] x = {7,6,5,4}; static { x[1] = 8; x[4] = 3; }
    C. for(int y = 10; y < 10; y++) doStuff(y);
    D. void doOne(int x) { doTwo(x); } void doTwo(int y) { doThree(y); } void doThree(int z) { doTwo(z); }
    E. for(int x = 0; x < 1000000000; x++) doStuff(x);
    F. void counter(int i) { counter(++i); }

  • Question 208:

    Given two files, GrizzlyBear.java and Salmon.java:

    1. package animals.mammals;

    2.

    3. public class GrizzlyBear extends Bear {

    4. void hunt() {

    5. Salmon s = findSalmon();

    6. s.consume();

    7. }

    8. }

    1. package animals.fish;

    2.

    3. public class Salmon extends Fish {

    4. public void consume() { /* do stuff */ }

    5. }

    If both classes are in the correct directories for their packages, and the Mammal class correctly defines the findSalmon() method, which change allows this code to compile?

    A. add import animals.mammals.*; at line 2 in Salmon.java
    B. add import animals.fish.*; at line 2 in GrizzlyBear.java
    C. add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java
    D. add import animals.mammals.GrizzlyBear.*; at line 2 in Salmon.java

  • Question 209:

    Given:

    11.

    String test = "Test A. Test B. Test C.";

    12.

    // insert code here

    13.

    String[] result = test.split(regex);

    Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"?

    A. String regex = "";
    B. String regex = " ";
    C. String regex = ".*";
    D. String regex = "\\s";
    E. String regex = "\\.\\s*";
    F. String regex = "\\w[ \.] +";

  • Question 210:

    Which two code fragments will execute the method doStuff() in a separate thread? (Choose two.)

    A. new Thread() { public void run() { doStuff(); } };
    B. new Thread() { public void start() { doStuff(); } };
    C. new Thread() { public void start() { doStuff(); } }.run();
    D. new Thread() { public void run() { doStuff(); } }.start();
    E. new Thread(new Runnable() { public void run() { doStuff(); } }).run();
    F. new Thread(new Runnable() { public void run() { doStuff(); } }).start();

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.