[Free] 2017(Jan) EnsurePass Braindumps Oracle 1z0-851 Dumps with VCE and PDF 61-70

Ensurepass.com : Ensure you pass the IT Exams
2017 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: 61 – (Topic 1)

Given:

  1. public class TestString1 {

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

  3. String str = quot;420quot;; 4. str = 42;

  1. System.out.print(str); 6. }

    7. }

    What is the output?

    1. 42 B. 420 C. 462

D. 42042

  1. Compilation fails.

  2. An exception is thrown at runtime.

Answer: D

Question No: 62 – (Topic 1)

Given:

  1. Date date = new Date();

  2. df.setLocale(Locale.ITALY);

  3. String s = df.format(date);

The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000?

  1. The value of s is 14-dic-2000.

  2. The value of s is Dec 14, 2000.

  3. An exception is thrown at runtime.

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

    Answer: D

    Question No: 63 – (Topic 1)

    Given:

    1. public class KungFu {

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

    3. Integer x = 400;

    4. Integer y = x; 5. x ;

  1. StringBuilder sb1 = new StringBuilder(quot;123quot;);

  2. StringBuilder sb2 = sb1;

  3. sb1.append(quot;5quot;);

  4. System.out.println((x==y) quot; quot; (sb1==sb2));

    10. }

    11. }

    What is the result?

    1. true true

    2. false true

    3. true false

    4. false false

    5. Compilation fails.

    6. An exception is thrown at runtime.

      Answer: B

      Question No: 64 – (Topic 1)

      Given that the current directory is empty, and that the user has read and write privileges to the current directory, and the following:

      1. import java.io.*;

      2. public class Maker {

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

      4. File dir = new File(quot;dirquot;);

      5. File f = new File(dir, quot;fquot;); 6. }

        7. }

        Which statement is true?

        1. Compilation fails.

        2. Nothing is added to the file system.

        3. Only a new file is created on the file system.

        4. Only a new directory is created on the file system.

        5. Both a new file and a new directory are created on the file system.

Answer: B

Question No: 65 – (Topic 1)

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: 66 – (Topic 1)

Given that t1 is a reference to a live thread, which is true?

  1. The Thread.sleep() method can take t1 as an argument.

  2. The Object.notify() method can take t1 as an argument.

  3. The Thread.yield() method can take t1 as an argument.

  4. The Thread.setPriority() method can take t1 as an argument.

  5. The Object.notify() method arbitrarily chooses which thread to notify.

Answer: E

Question No: 67 – (Topic 1)

Given that Triangle implements Runnable, and:

  1. void go() throws Exception {

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

  3. t.start();

34. for(int x = 1; x lt; 100000; x ) {

  1. //insert code here

  2. if(x0 == 0) System.out.print(quot;gquot;); 37. } }

  1. public void run() {

  2. try {

40. for(int x = 1; x lt; 100000; x ) {

  1. // insert the same code here

  2. if(x0 == 0) System.out.print(quot;tquot;);

43. }

44. } catch (Exception e) { }

45. }

Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to temporarily pause and allow the other thread to execute? (Choose two.)

  1. Thread.wait();

  2. Thread.join();

  3. Thread.yield();

  4. Thread.sleep(1);

  5. Thread.notify();

    Answer: C,D

    Question No: 68 – (Topic 1)

    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: 69 – (Topic 1)

      Given:

      1. public class Threads5 {

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

      3. new Thread(new Runnable() {

      4. public void run() {

      5. System.out.print(quot;barquot;);

        6. }}).start();

        7. }

        8. }

        What is the result?

        1. Compilation fails.

        2. An exception is thrown at runtime.

        3. The code executes normally and prints quot;barquot;.

        4. The code executes normally, but nothing prints.

Answer: C

Question No: 70 – (Topic 1)

Given:

  1. public class PingPong implements Runnable {

  2. synchronized void hit(long n) {

13. for(int i = 1; i lt; 3; i )

14. System.out.print(n quot;-quot; i quot; quot;);

15. }

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

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

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

19. }

  1. public void run() {

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

22. }

23. }

Which two statements are true? (Choose two.)

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

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

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

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

Answer: C,D

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

2017 EnsurePass IT Certification PDF and VCE

Leave a Reply

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