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

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

Given:

  1. class Line {

  2. public class Point { public int x,y;}

  3. public Point getPoint() { return new Point(); }

13. }

  1. class Triangle {

  2. public Triangle() {

  3. // insert code here

17. }

18. }

Which code, inserted at line 16, correctly retrieves a local instance of a Point object?

  1. Point p = Line.getPoint();

  2. Line.Point p = Line.getPoint();

  3. Point p = (new Line()).getPoint();

  4. Line.Point p = (new Line()).getPoint();

Answer: D

Question No: 12 – (Topic 1)

Given:

  1. class Alpha {

  2. public void foo() { System.out.print(quot;Afoo quot;); }

13. }

  1. public class Beta extends Alpha {

  2. public void foo() { System.out.print(quot;Bfoo quot;); }

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

  4. Alpha a = new Beta();

  5. Beta b = (Beta)a;

  6. a.foo();

  7. b.foo();

21. }

22. }

What is the result?

  1. Afoo Afoo

  2. Afoo Bfoo

  3. Bfoo Afoo

  4. Bfoo Bfoo

  5. Compilation fails.

  6. An exception is thrown at runtime.

Answer: D

Question No: 13 – (Topic 1)

Click the Exhibit button. Which statement is true about the classes and interfaces in the exhibit?

Ensurepass 2017 PDF and VCE

  1. Compilation will succeed for all classes and interfaces.

  2. Compilation of class C will fail because of an error in line 2.

  3. Compilation of class C will fail because of an error in line 6.

  4. Compilation of class AImpl will fail because of an error in line 2.

Answer: C

Question No: 14 – (Topic 1)

Which two code fragments correctly create and initialize a static array of int elements? (Choose two.)

  1. static final int[] a = { 100,200 };

  2. static final int[] a;

    static { a=new int[2]; a[0]=100; a[1]=200; }

  3. static final int[] a = new int[2]{ 100,200 };

  4. static final int[] a;

static void init() { a = new int[3]; a[0]=100; a[1]=200; }

Answer: A,B

Question No: 15 – (Topic 1)

Given:

  1. interface Foo { int bar(); }

  2. public class Sprite {

  3. public int fubar( Foo foo ) { return foo.bar(); }

  4. public void testFoo() {

  5. fubar(

  6. // insert code here 16. );

17. }

18. }

Which code, inserted at line 15, allows the class Sprite to compile?

  1. Foo { public int bar() { return 1; }

  2. new Foo { public int bar() { return 1; }

  3. new Foo() { public int bar() { return 1; }

  4. new class Foo { public int bar() { return 1; }

    Answer: C

    Question No: 16 – (Topic 1)

    Given:

    1. class Alligator {

    2. public static void main(String[] args) { 3. int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}};

4. int [][]y = x;

  1. System.out.println(y[2][1]); 6. }

    7. }

    What is the result?

    1. 2

    2. 3

    3. 4

    4. 6

    5. 7

    6. Compilation fails.

Answer: E

Question No: 17 – (Topic 1)

Given:

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

23. String s1 = quot;123quot;;

  1. // insert code here

  2. System.out.println(sb1 quot; quot; s1);

Which code fragment, inserted at line 24, outputs quot;123abc 123abcquot;?

  1. sb1.append(quot;abcquot;); s1.append(quot;abcquot;);

  2. sb1.append(quot;abcquot;); s1.concat(quot;abcquot;);

  3. sb1.concat(quot;abcquot;); s1.append(quot;abcquot;);

  4. sb1.concat(quot;abcquot;); s1.concat(quot;abcquot;);

  5. sb1.append(quot;abcquot;); s1 = s1.concat(quot;abcquot;);

  6. sb1.concat(quot;abcquot;); s1 = s1.concat(quot;abcquot;);

  7. sb1.append(quot;abcquot;); s1 = s1 s1.concat(quot;abcquot;);

  8. sb1.concat(quot;abcquot;); s1 = s1 s1.concat(quot;abcquot;);

Answer: E

Question No: 18 – (Topic 1)

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

  1. import java.io.*;

  2. public class DOS {

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

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

  5. dir.mkdir();

  6. File f1 = new File(dir, quot;f1.txtquot;);

  7. try {

  8. f1.createNewFile();

  9. } catch (IOException e) { ; }

  10. File newDir = new File(quot;newDirquot;);

  11. dir.renameTo(newDir);

22. }

23. }

Which statement is true?

  1. Compilation fails.

  2. The file system has a new empty directory named dir.

  3. The file system has a new empty directory named newDir.

  4. The file system has a directory named dir, containing a file f1.txt.

  5. The file system has a directory named newDir, containing a file f1.txt.

Answer: E

Question No: 19 – (Topic 1)

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

Given:

  1. String test = quot;Test A. Test B. Test C.quot;;

  2. // insert code here

  3. String[] result = test.split(regex);

Which regular expression, inserted at line 12, correctly splits test into quot;Test Aquot;, quot;Test Bquot;, and quot;Test Cquot;?

  1. String regex = quot;quot;;

  2. String regex = quot; quot;;

  3. String regex = quot;.*quot;;

  4. String regex = quot;\\squot;;

  5. String regex = quot;\\.\\s*quot;;

  6. String regex = quot;\\w[ \.] quot;;

Answer: E

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.