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

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: 41 DRAG DROP

Click the Task button.

Ensurepass 2018 PDF and VCE

Answer:

Ensurepass 2018 PDF and VCE

Question No: 42

A programmer has an algorithm that requires a java.util.List that provides an efficient implementation of add(0, object), but does NOT need to support quick random access. What supports these requirements?

  1. java.util.Queue

  2. java.util.ArrayList

  3. java.util.LinearList

  4. java.util.LinkedList

Answer: D

Question No: 43

Given a pre-generics implementation of a method:

  1. public static int sum(List list) {

  2. int sum = 0;

  3. for ( Iterator iter = list.iterator(); iter.hasNext(); ) {

  4. int i = ((Integer)iter.next()).intValue();

  5. sum = i;

16. }

17. return sum;

18. }

What three changes allow the class to be used with generics and avoid an unchecked warning? (Choose three.)

  1. Remove line 14.

  2. Replace line 14 with quot;int i = iter.next();quot;.

  3. Replace line 13 with quot;for (int i : intList) {quot;.

  4. Replace line 13 with quot;for (Iterator iter : intList) {quot;.

  5. Replace the method declaration with quot;sum(Listlt;intgt; intList)quot;.

  6. Replace the method declaration with quot;sum(Listlt;Integergt; intList)quot;.

Answer: A,C,F

Question No: 44

Given:

  1. import java.util.*;

  2. public class Explorer2 {

  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);

19. subs = (TreeSet)s.subSet(608, true, 611, true); 20. s.add(629);

21. 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: E

Question No: 45

Given that the elements of a PriorityQueue are ordered according to natural ordering, and:

  1. import java.util.*;

  2. public class GetInLine {

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

  4. PriorityQueuelt;Stringgt; pq = new PriorityQueuelt;Stringgt;();

  5. pq.add(quot;bananaquot;);

  6. pq.add(quot;pearquot;);

  7. pq.add(quot;applequot;);

  8. System.out.println(pq.poll() quot; quot; pq.peek());

    10. }

    11. }

    What is the result?

    1. apple pear

    2. banana pear

    3. apple apple

    4. apple banana

    5. banana banana

      Answer: D

      Question No: 46

      Given:

      1. import java.util.*;

      2. public class SortOf {

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

      4. ArrayListlt;Integergt; a = new ArrayListlt;Integergt;();

      9. a.add(1); a.add(5); a.add(3);

      11. Collections.sort(a);

      12. a.add(2);

      1. Collections.reverse(a);

      2. System.out.println(a);

      15. }

      16. }

      What is the result?

      A. [1, 2, 3, 5]

      B. [2, 1, 3, 5]

      C. [2, 5, 3, 1]

      D. [5, 3, 2, 1]

      E. [1, 3, 5, 2]

    6. Compilation fails.

    7. An exception is thrown at runtime.

Answer: C

Question No: 47

Given:

  1. import java.util.*;

  2. public class G1 {

  3. public void takeList(Listlt;? extends Stringgt; list) {

  4. // insert code here 7. }

    8. }

    Which three code fragments, inserted independently at line 6, will compile? (Choose three.)

    1. list.add(quot;fooquot;);

    2. Object o = list;

    3. String s = list.get(0);

    4. list = new ArrayListlt;Stringgt;();

    5. list = new ArrayListlt;Objectgt;();

      Answer: B,C,D

      Question No: 48

      Given:

      1. import java.util.*; 2.

  1. public class LetterASort{

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

  3. ArrayListlt;Stringgt; strings = new ArrayListlt;Stringgt;();

  4. strings.add(quot;aAaAquot;);

  5. strings.add(quot;AaAquot;);

  6. strings.add(quot;aAaquot;);

  7. strings.add(quot;AAaaquot;);

  8. Collections.sort(strings);

  9. for (String s : strings) { System.out.print(s quot; quot;); }

12. }

13. }

What is the result?

  1. Compilation fails.

  2. aAaA aAa AAaa AaA

  3. AAaa AaA aAa aAaA

  4. AaA AAaa aAaA aAa

  5. aAa AaA aAaA AAaa

  6. An exception is thrown at runtime.

    Answer: C

    Question No: 49

    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: 50 DRAG DROP

Click the Task button.

Ensurepass 2018 PDF and VCE

Answer:

Ensurepass 2018 PDF and VCE

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.