[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-852 Dumps with VCE and PDF 51-60

By | January 25, 2018

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

Java Standard Edition 6 Programmer Certified Professional Upgrade Exam

Question No: 51

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

Given:

  1. import java.util.*;

  2. public class Explorer3 {

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

  4. TreeSetlt;Integergt; s = new TreeSetlt;Integergt;();

  5. TreeSetlt;Integergt; subs = new TreeSetlt;Integergt;() 17. for(int i = 606; i lt; 613; i )

18. if(i%2 == 0) s.add(i);

  1. subs = (TreeSet)s.subSet(608, true, 611, true);

  2. subs.add(629);

  3. System.out.println(s quot; quot; subs);

22. }

23. }

What is the result?

  1. Compilation fails.

  2. An exception is thrown at runtime.

C. [608, 610, 612, 629] [608, 610]

D. [608, 610, 612, 629] [608, 610, 629]

E. [606, 608, 610, 612, 629] [608, 610]

F. [606, 608, 610, 612, 629] [608, 610, 629]

Answer: B

Question No: 53

Given:

  1. Object [] myObjects = {

  2. new Integer(12),

  3. new String(quot;fooquot;),

  4. new Integer(5),

  5. new Boolean(true) 28. };

  1. Arrays.sort(myObjects);

  2. for(int i=0; ilt;myObjects.length; i ) {

  3. System.out.print(myObjects[i].toString());

  4. System.out.print(quot; quot;);

33. }

What is the result?

  1. Compilation fails due to an error in line 23.

  2. Compilation fails due to an error in line 29.

  3. A ClassCastException occurs in line 29.

  4. A ClassCastException occurs in line 31.

  5. The value of all four objects prints in natural order.

Answer: C

Question No: 54

Click the Exhibit button. Which statement is true about the set variable on line 12?

Ensurepass 2018 PDF and VCE

  1. The set variable contains all six elements from the coll collection, and the order is guaranteed to be preserved.

  2. The set variable contains only three elements from the coll collection, and the order is guaranteed to be preserved.

  3. The set variable contains all six elements from the coll collection, but the order is NOT guaranteed to be preserved.

  4. The set variable contains only three elements from the coll collection, but the order is NOTguaranteed to be preserved.

Answer: D

Question No: 55

Given:

  1. // insert code here

  2. private N min, max;

  3. public N getMin() { return min; }

  4. public N getMax() { return max; }

  5. public void add(N added) {

  6. if (min == null || added.doubleValue() lt; min.doubleValue())

  7. min = added;

  8. if (max == null || added.doubleValue() gt; max.doubleValue())

  9. max = added;

20. }

21. }

Which two, inserted at line 11, will allow the code to compile? (Choose two.)

  1. public class MinMaxlt;?gt; {

  2. public class MinMaxlt;? extends Numbergt; {

  3. public class MinMaxlt;N extends Objectgt; {

  4. public class MinMaxlt;N extends Numbergt; {

  5. public class MinMaxlt;? extends Objectgt; {

  6. public class MinMaxlt;N extends Integergt; {

Answer: D,F

Question No: 56

Given:

  1. import java.util.*;

  2. public class Hancock {

  3. // insert code here

  4. list.add(quot;fooquot;); 7. }

    8. }

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

    1. public void addStrings(List list) {

    2. public void addStrings(Listlt;Stringgt; list) {

    3. public void addStrings(Listlt;? super Stringgt; list) {

    4. public void addStrings(Listlt;? extends Stringgt; list) {

Answer: B,C

Question No: 57

Given:

  1. public void go() {

  2. String o = quot;quot;;

  3. z:

25. for(int x = 0; x lt; 3; x ) { 26. for(int y = 0; y lt; 2; y ) {

27. if(x==1) break;

28. if(x==2 amp;amp; y==1) break z;

29. o = o x y;

30. }

31. }

32. System.out.println(o);

33. }

What is the result when the go() method is invoked?

A. 00

B. 0001

C. 000120

D. 00012021

  1. Compilation fails.

  2. An exception is thrown at runtime.

Answer: C

Question No: 58

Given a method that must ensure that its parameter is not null:

  1. public void someMethod(Object value) {

  2. // check for null value

20. System.out.println(value.getClass());

21. }

What, inserted at line 12, is the appropriate way to handle a null value?

  1. assert value == null;

  2. assert value != null, quot;value is nullquot;;

  3. if (value == null) {

    throw new AssertionException(quot;value is nullquot;);

    }

  4. if (value == null) {

throw new IllegalArgumentException(quot;value is nullquot;);

}

Answer: D

Question No: 59

Given:

  1. public class Test {

  2. public enum Dogs {collie, harrier, shepherd};

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

  4. Dogs myDog = Dogs.shepherd;

  5. switch (myDog) {

  6. case collie:

  7. System.out.print(quot;collie quot;);

  8. case default:

  9. System.out.print(quot;retriever quot;);

  10. case harrier:

  11. System.out.print(quot;harrier quot;);

22. }

23. }

24. }

What is the result?

  1. harrier

  2. shepherd

  3. retriever

  4. Compilation fails.

  5. retriever harrier

  6. An exception is thrown at runtime.

Answer: D

Question No: 60

Given:

  1. class A {

  2. void foo() throws Exception { throw new Exception(); } 7. }

  1. class SubB2 extends A {

  2. void foo() { System.out.println(quot;B quot;); }

10. }

  1. class Tester {

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

  3. A a = new SubB2();

  4. a.foo();

15. }

16. }

What is the result?

  1. B

  2. B, followed by an Exception.

  3. Compilation fails due to an error on line 9.

  4. Compilation fails due to an error on line 14.

  5. An Exception is thrown with no other output.

Answer: D

100% Ensurepass Free Download!
Download Free Demo:1z0-852 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-852 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.