Act now and download your Oracle 1Z0-851 test today! Do not waste time for the worthless Oracle 1Z0-851 tutorials. Download Renovate Oracle Java Standard Edition 6 Programmer Certified Professional Exam exam with real questions and answers and begin to learn Oracle 1Z0-851 with a classic professional.

2021 Aug 1z0-851 enu:

Q51. Given:

23. Object [] myObjects = {

24. new Integer(12),

25. new String("foo"),

26. new Integer(5),

27. new Boolean(true)

28. };

29. Arrays.sort(myObjects);

30. for(int i=0; i<myObjects.length; i++) {

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

32. System.out.print(" ");

33. }

What is the result?

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

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

C. A ClassCastException occurs in line 29.

D. A ClassCastException occurs in line 31.

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

Answer: C


Q52. Given:

11. static void test() {

12. try {

13. String x = null;

14. System.out.print(x.toString() + " ");

15. }

16. finally { System.out.print("finally "); }

17. }

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

19. try { test(); }

20. catch (Exception ex) { System.out.print("exception "); }

21. }

What is the result?

A. null

B. finally

C. null finally

D. Compilation fails.

E. finally exception

Answer: E


Q53. Given:

1. interface DoStuff2 {

2. float getRange(int low, int high); }

3.

4. interface DoMore {

5. float getAvg(int a, int b, int c); }

6.

7. abstract class DoAbstract implements DoStuff2, DoMore { }

8.

9. class DoStuff implements DoStuff2 {

10. public float getRange(int x, int y) { return 3.14f; } }

11.

12. interface DoAll extends DoMore {

13. float getAvg(int a, int b, int c, int d); }

What is the result?

A. The file will compile without error.

B. Compilation fails. Only line 7 contains an error.

C. Compilation fails. Only line 12 contains an error.

D. Compilation fails. Only line 13 contains an error.

E. Compilation fails. Only lines 7 and 12 contain errors.

F. Compilation fails. Only lines 7 and 13 contain errors.

G. Compilation fails. Lines 7, 12, and 13 contain errors.

Answer: A


Q54. Given:

12. NumberFormat nf = NumberFormat.getInstance();

13. nf.setMaximumFractionDigits(4);

14. nf.setMinimumFractionDigits(2);

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

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

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

A. The value of b is 2.

B. The value of a is 3.14.

C. The value of b is 2.00.

D. The value of a is 3.141.

E. The value of a is 3.1415.

F. The value of a is 3.1416.

G. The value of b is 2.0000.

Answer: CF


Q55. 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?

A. java.util.Queue

B. java.util.ArrayList

C. java.util.LinearList

D. java.util.LinkedList

Answer: D


1Z0-851  download

Renewal oracle 1z0-851 certification:

Q56. Given:

11. public enum Title {

12. MR("Mr."), MRS("Mrs."), MS("Ms.");

13. private final String title;

14. private Title(String t) { title = t; }

15. public String format(String last, String first) {

16. return title + " " + first + " " + last;

17. }

18. }

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

20. System.out.println(Title.MR.format("Doe", "John"));

21. }

What is the result?

A. Mr. John Doe

B. An exception is thrown at runtime.

C. Compilation fails because of an error in line 12.

D. Compilation fails because of an error in line 15.

E. Compilation fails because of an error in line 20.

Answer: A


Q57. Which two statements are true? (Choose two.)

A. It is possible for more than two threads to deadlock at once.

B. The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.

C. Deadlocked threads release once their sleep() method's sleep duration has expired.

D. Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.

E. It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.

F. If a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield().

Answer: AF


Q58. 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.)

A. The class implements java.lang.Comparable.

B. The class implements java.util.Comparator.

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

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

Answer: AC


Q59. Given:

11. public class PingPong implements Runnable {

12. synchronized void hit(long n) {

13. for(int i = 1; i < 3; i++)

14. System.out.print(n + "-" + i + " ");

15. }

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

17. new Thread(new PingPong()).start();

18. new Thread(new PingPong()).start();

19. }

20. public void run() {

21. hit(Thread.currentThread().getId());

22. }

23. }

Which two statements are true? (Choose two.)

A. The output could be 8-1 7-2 8-2 7-1

B. The output could be 7-1 7-2 8-1 6-1

C. The output could be 8-1 7-1 7-2 8-2

D. The output could be 8-1 8-2 7-1 7-2

Answer: CD


Q60. Given:

1. public class Donkey {

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

3. boolean assertsOn = false;

4. assert (assertsOn) : assertsOn = true;

5. if(assertsOn) {

6. System.out.println("assert is on");

7. }

8. }

9. }

If class Donkey is invoked twice, the first time without assertions enabled, and the second time with assertions enabled, what are the results?

A. no output

B. no output

assert is on

C. assert is on

D. no output

An AssertionError is thrown.

E. assert is on

An AssertionError is thrown.

Answer: D