[Free] 2018(Jan) EnsurePass Dumpsleader Oracle 1z0-851 Dumps with VCE and PDF 161-170

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: 161 – (Topic 2)

Click the Exhibit button. What is the result?

Ensurepass 2018 PDF and VCE

  1. go in Goban go in Sente

  2. go in Sente go in Goban

  3. go in Sente go in Goban

  4. go in Goban go in Sente

  5. Compilation fails because of an error in line 17.

Answer: C

Question No: 162 – (Topic 2)

Given:

  1. NumberFormat nf = NumberFormat.getInstance();

  2. nf.setMaximumFractionDigits(4);

  3. nf.setMinimumFractionDigits(2);

  4. String a = nf.format(3.1415926);

  5. String b = nf.format(2);

Which two statements are true about the result if the default locale is Locale.US? (Choose two.)

  1. The value of b is 2.

  2. The value of a is 3.14.

  3. The value of b is 2.00.

  4. The value of a is 3.141.

  5. The value of a is 3.1415.

  6. The value of a is 3.1416.

  7. The value of b is 2.0000.

Answer: C,F

Question No: 163 – (Topic 2)

Given:

  1. String test = quot;a1b2c3quot;;

  2. String[] tokens = test.split(quot;\\dquot;);

  3. for(String s: tokens) System.out.print(s quot; quot;); What is the result?

A. a b c

B. 1 2 3

  1. a1b2c3

  2. a1 b2 c3

  3. Compilation fails.

  4. The code runs with no output.

  5. An exception is thrown at runtime.

Answer: A

Question No: 164 – (Topic 2)

Given:

  1. class Converter {

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

  3. Integer i = args[0];

  4. int j = 12;

  5. System.out.println(quot;It is quot; (j==i) quot; that j==i.quot;);

16. }

17. }

What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?

  1. It is true that j==i.

  2. It is false that j==i.

  3. An exception is thrown at runtime.

  4. Compilation fails because of an error in line 13.

    Answer: D

    Question No: 165 – (Topic 2)

    Given:

    1. public class BuildStuff {

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

    3. Boolean test = new Boolean(true);

    4. Integer x = 343;

    5. Integer y = new BuildStuff().go(test, x);

    6. System.out.println(y); 7. }

  1. int go(Boolean b, int i) {

  2. if(b) return (i/7);

  3. return (i/49);

11. }

12. }

What is the result?

  1. 7

  2. 49

C. 343

  1. Compilation fails.

  2. An exception is thrown at runtime.

Answer: B

Question No: 166 – (Topic 2)

Given:

  1. String csv = quot;Sue,5,true,3quot;;

  2. Scanner scanner = new Scanner( csv );

  3. scanner.useDelimiter(quot;,quot;);

  4. int age = scanner.nextInt();

What is the result?

  1. Compilation fails.

  2. After line 15, the value of age is 5.

  3. After line 15, the value of age is 3.

  4. An exception is thrown at runtime.

    Answer: D

    Question No: 167 – (Topic 2)

    Given:

    1. import java.util.*;

    2. public class WrappedString {

    3. private String s;

    4. public WrappedString(String s) { this.s = s; }

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

    6. HashSetlt;Objectgt; hs = new HashSetlt;Objectgt;();

    7. WrappedString ws1 = new WrappedString(quot;aardvarkquot;);

    8. WrappedString ws2 = new WrappedString(quot;aardvarkquot;);

    9. String s1 = new String(quot;aardvarkquot;);

    10. String s2 = new String(quot;aardvarkquot;);

    11. hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2);

    12. System.out.println(hs.size()); } } What is the result?

  1. 0

  2. 1

  3. 2

  4. 3

  5. 4

  6. Compilation fails.

  7. An exception is thrown at runtime.

Answer: D

Question No: 168 – (Topic 2)

Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true? (Choose two.)

  1. The class implements java.lang.Comparable.

  2. The class implements java.util.Comparator.

  3. The interface used to implement sorting allows this class to define only one sort sequence.

  4. The interface used to implement sorting allows this class to define many different sort sequences.

    Answer: A,C

    Question No: 169 – (Topic 2)

    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]?

      1. Set set = new TreeSet();

      2. Set set = new HashSet();

      3. Set set = new SortedSet();

      4. List set = new SortedList();

      5. Set set = new LinkedHashSet();

Answer: A

Question No: 170 – (Topic 2)

Given:

  1. public class Person {

  2. private name;

  3. public Person(String name) {

  4. this.name = name;

15. }

  1. public int hashCode() {

  2. return 420;

18. }

19. }

Which statement is true?

  1. The time to find the value from HashMap with a Person key depends on the size of the map.

  2. Deleting a Person key from a HashMap will delete all map entries for all keys of type Person.

  3. Inserting a second Person object into a HashSet will cause the first Person object to be removed as a duplicate.

  4. The time to determine whether a Person object is contained in a HashSet is constant and does NOT depend on the size of the map.

    Answer: A

    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

Your email address will not be published. Required fields are marked *

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