[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-851 Dumps with VCE and PDF 131-140

By | January 25, 2018

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-851
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-851.html

Java Standard Edition 6 Programmer Certified Professional Exam

Question No: 131 – (Topic 2)

Given:

  1. public class Threads3 implements Runnable {

  2. public void run() {

  3. System.out.print(quot;runningquot;); 4. }

  1. public static void main(String[] args) {

  2. Thread t = new Thread(new Threads3());

  3. t.run();

  4. t.run();

  5. t.start();

    10. }

    11. }

    What is the result?

    1. Compilation fails.

    2. An exception is thrown at runtime.

    3. The code executes and prints quot;runningquot;.

    4. The code executes and prints quot;runningrunningquot;.

    5. The code executes and prints quot;runningrunningrunningquot;.

      Answer: E

      Question No: 132 – (Topic 2)

      Given classes defined in two different files:

      1. package util;

      2. public class BitUtils {

      3. public static void process(byte[] b) { /* more code here */ } 4. }

  1. package app;

  2. public class SomeApp {

  3. public static void main(String[] args) {

  4. byte[] bytes = new byte[256];

  5. // insert code here 6. }

    7. }

    What is required at line 5 in class SomeApp to use the process method of BitUtils?

    1. process(bytes);

    2. BitUtils.process(bytes);

    3. util.BitUtils.process(bytes);

    4. SomeApp cannot use methods in BitUtils.

    5. import util.BitUtils.*; process(bytes);

Answer: C

Question No: 133 – (Topic 2)

A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Book class? (Choose three.)

  1. The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar.

  2. The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar..

  3. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar/Paper.class.

  4. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar.

  5. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -cp

    /foo/myLib.jar/Paper Book.java.

  6. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -d

    /foo/myLib.jar Book.java

  7. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac – classpath /foo/myLib.jar Book.java

Answer: B,D,G

Question No: 134 – (Topic 2)

Given:

  1. class Snoochy {

  2. Boochy booch;

  3. public Snoochy() { booch = new Boochy(this); }

14. } 15.

  1. class Boochy {

  2. Snoochy snooch;

  3. public Boochy(Snoochy s) { snooch = s; }

  4. } And the statements:

  1. public static void main(String[] args) {

  2. Snoochy snoog = new Snoochy();

  3. snoog = null;

  4. // more code here

25. }

Which statement is true about the objects referenced by snoog, snooch, and booch immediately after line 23 executes?

  1. None of these objects are eligible for garbage collection.

  2. Only the object referenced by booch is eligible for garbage collection.

  3. Only the object referenced by snoog is eligible for garbage collection.

  4. Only the object referenced by snooch is eligible for garbage collection.

  5. The objects referenced by snooch and booch are eligible for garbage collection.

Answer: E

Question No: 135 – (Topic 2)

Given:

  1. public class Batman {

  2. int squares = 81;

  3. public static void main(String[] args) {

  4. new Batman().go(); 7. }

  1. void go() {

  2. incr( squares);

  3. System.out.println(squares);

11. }

12. void incr(int squares) { squares = 10; }

13. }

What is the result?

  1. 81

  2. 82

  3. 91

  4. 92

  5. Compilation fails.

  6. An exception is thrown at runtime.

    Answer: B

    Question No: 136 – (Topic 2)

    Given classes defined in two different files:

    1. package util;

    2. public class BitUtils {

    3. private static void process(byte[] b) {} 4. }

  1. package app;

  2. public class SomeApp {

  3. public static void main(String[] args) {

  4. byte[] bytes = new byte[256];

  5. // insert code here 6. }

    7. }

    What is required at line 5 in class SomeApp to use the process method of BitUtils?

    1. process(bytes);

    2. BitUtils.process(bytes);

    3. app.BitUtils.process(bytes);

    4. util.BitUtils.process(bytes);

    5. import util.BitUtils.*; process(bytes);

    6. SomeApp cannot use the process method in BitUtils.

Answer: F

Question No: 137 – (Topic 2)

A UNIX user named Bob wants to replace his chess program with a new one, but he is not sure where the old one is installed. Bob is currently able to run a Java chess program starting from his home directory /home/bob using the command: java -classpath

/test:/home/bob/downloads/*.jar games.Chess Bob#39;s CLASSPATH is set (at login time) to:

/usr/lib:/home/bob/classes:/opt/java/lib:/opt/java/lib/*.jar What is a possible location for the Chess.class file?

  1. /test/Chess.class

  2. /home/bob/Chess.class

  3. /test/games/Chess.class

  4. /usr/lib/games/Chess.class

  5. /home/bob/games/Chess.class

  6. inside jarfile /opt/java/lib/Games.jar (with a correct manifest)

  7. inside jarfile /home/bob/downloads/Games.jar (with a correct manifest)

Answer: C

Question No: 138 – (Topic 2)

Click the Exhibit button. What is the output of the program shown in the exhibit?

Ensurepass 2018 PDF and VCE

A. 300-100-100-100-100

B. 300-300-100-100-100

C. 300-300-300-100-100

D. 300-300-300-300-100

Answer: B

Question No: 139 – (Topic 2)

Given the following directory structure: bigProject |-source | |-Utils.java | |-classes |- And the following command line invocation: javac -d classes source/Utils.java Assume the current directory is bigProject, what is the result?

  1. If the compile is successful, Utils.class is added to the source directory.

  2. The compiler returns an invalid flag error.

  3. If the compile is successful, Utils.class is added to the classes directory.

  4. If the compile is successful, Utils.class is added to the bigProject directory.

Answer: C

Question No: 140 – (Topic 2)

Given:

  1. interface Fish { }

  2. class Perch implements Fish { }

  3. class Walleye extends Perch { }

  4. class Bluegill { }

  5. public class Fisherman {

  6. public static void main(String[] args) {

  7. Fish f = new Walleye();

  8. Walleye w = new Walleye();

  9. Bluegill b = new Bluegill();

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

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

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

15. }

16. }

What is the result?

  1. w-f

  2. f-p w-f

  3. w-f b-f

  4. f-p w-f b-f

  5. Compilation fails.

  6. An exception is thrown at runtime.

    Answer: B

    100% Ensurepass Free Download!
    Download Free Demo:1z0-851 Demo PDF
    100% Ensurepass Free Guaranteed!
    1z0-851 Dumps

    EnsurePass ExamCollection Testking
    Lowest Price Guarantee Yes No No
    Up-to-Dated Yes No No
    Real Questions Yes No No
    Explanation Yes No No
    PDF VCE Yes No No
    Free VCE Simulator Yes No No
    Instant Download Yes No No

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.