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

    Given:

    1.

    public class TestString1 {

    2.

    public static void main(String[] args) {

    3.

    String str = "420";

    4.

    str += 42;

    5.

    System.out.print(str);

    6.

    }

    7.

    }

    What is the output?

    A. 42
    B. 420
    C. 462
    D. 42042
    E. Compilation fails.
    F. An exception is thrown at runtime.

  • Question 122:

    Given:

    11.

    public class Rainbow {

    12.

    public enum MyColor {

    13.

    RED(0xff0000), GREEN(0x00ff00), BLUE(0x0000ff);

    14.

    private final int rgb;

    15.

    MyColor(int rgb) { this.rgb = rgb; }

    16.

    public int getRGB() { return rgb; }

    17.

    };

    18.

    public static void main(String[] args) {

    19.

    // insert code here

    20.

    }

    21.

    }

    Which code fragment, inserted at line 19, allows the Rainbow class to compile?

    A. MyColor skyColor = BLUE;
    B. MyColor treeColor = MyColor.GREEN;
    C. if(RED.getRGB() < BLUE.getRGB()) { }
    D. Compilation fails due to other error(s) in the code.
    E. MyColor purple = new MyColor(0xff00ff);
    F. MyColor purple = MyColor.BLUE + MyColor.RED;

  • Question 123:

    Given

    11.

    public interface Status {

    12.

    /* insert code here */ int MY_VALUE = 10;

    13.

    }

    Which three are valid on line 12? (Choose three.)

    A. final
    B. static
    C. native
    D. public
    E. private
    F. abstract
    G. protected

  • Question 124:

    Given:

    1.

    class Pizza {

    2.

    java.util.ArrayList toppings;

    3.

    public final void addTopping(String topping) {

    4.

    toppings.add(topping);

    5.

    }

    6.

    }

    7.

    public class PepperoniPizza extends Pizza {

    8.

    public void addTopping(String topping) {

    9.

    System.out.println("Cannot add Toppings");

    10.

    }

    11.

    public static void main(String[] args) {

    12.

    Pizza pizza = new PepperoniPizza();

    13.

    pizza.addTopping("Mushrooms");

    14.

    }

    15.

    }

    What is the result?

    A. Compilation fails.
    B. Cannot add Toppings
    C. The code runs with no output.
    D. A NullPointerException is thrown in Line 4.

  • Question 125:

    Given:

    3.

    import java.util.*;

    4.

    public class Hancock {

    5.

    // insert code here

    6.

    list.add("foo");

    7.

    }

    8.

    }

    Which two code fragments, inserted independently at line 5, will compile without warnings? (Choose two.)

    A. public void addStrings(List list) {
    B. public void addStrings(List list) {
    C. public void addStrings(List
    D. public void addStrings(List

  • Question 126:

    Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choose two.)

    A. When using versions of Java technology earlier than 5.0.
    B. When sharing a StringBuffer among multiple threads.
    C. When using the java.io class StringBufferInputStream.
    D. When you plan to reuse the StringBuffer to build more than one string.

  • Question 127:

    Given:

    11 class Alpha {

    12 public void foo() { System.out.print("Afoo "); } 13 }

    14 public class Beta extends Alpha {

    15 public void foo() { System.out.print("Bfoo "); } 16 public static void main(String[] args) {

    17 Alpha a = new Beta();

    18 Beta b = (Beta)a;

    19 a.foo();

    20 b.foo();

    21 }

    22 }

    What is the result?

    A. Afoo Afoo
    B. Afoo Bfoo
    C. Bfoo Afoo
    D. Bfoo Bfoo
    E. Compilation fails.
    F. An exception is thrown at runtime.

  • Question 128:

    Given:

    31.

    // some code here

    32.

    try {

    33.

    // some code here

    34.

    } catch (SomeException se) {

    35.

    // some code here

    36.

    } finally {

    37.

    // some code here

    38.

    }

    Under which three circumstances will the code on line 37 be executed? (Choose three.)

    A. The instance gets garbage collected.
    B. The code on line 33 throws an exception.
    C. The code on line 35 throws an exception.
    D. The code on line 31 throws an exception.
    E. The code on line 33 executes successfully.

  • Question 129:

    Given a class Repetition:

    1.

    package utils;

    2.

    3.

    public class Repetition {

    4.

    public static String twice(String s) { return s + s; }

    5.

    } and given another class Demo: 1. // insert code here 2.

    3.

    public class Demo {

    4.

    public static void main(String[] args) {

    5.

    System.out.println(twice("pizza"));

    6.

    }

    7.

    }

    Which code should be inserted at line 1 of Demo.java to compile and run Demo to print "pizzapizza"?

    A. import utils.*;
    B. static import utils.*;
    C. import utils.Repetition.*;
    D. static import utils.Repetition.*;
    E. import utils.Repetition.twice();
    F. import static utils.Repetition.twice;
    G. static import utils.Repetition.twice;

  • Question 130:

    Given:

    1.

    public class LineUp {

    2.

    public static void main(String[] args) {

    3.

    double d = 12.345;

    4.

    // insert code here

    5.

    }

    6.

    }

    Which code fragment, inserted at line 4, produces the output | 12.345|?

    A. System.out.printf("|%7d| \n", d);
    B. System.out.printf("|%7f| \n", d);
    C. System.out.printf("|%3.7d| \n", d);
    D. System.out.printf("|%3.7f| \n", d);
    E. System.out.printf("|%7.3d| \n", d);
    F. System.out.printf("|%7.3f| \n", d);

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.