Ensurepass.com : Ensure you pass the IT Exams
2018 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:
-
class Line {
-
public class Point { public int x,y;}
-
public Point getPoint() { return new Point(); }
13. }
-
class Triangle {
-
public Triangle() {
-
// insert code here
17. }
18. }
Which code, inserted at line 16, correctly retrieves a local instance of a Point object?
-
Point p = Line.getPoint();
-
Line.Point p = Line.getPoint();
-
Point p = (new Line()).getPoint();
-
Line.Point p = (new Line()).getPoint();
Answer: D
Question No: 12 – (Topic 1)
Given:
-
class Alpha {
-
public void foo() { System.out.print(quot;Afoo quot;); }
13. }
-
public class Beta extends Alpha {
-
public void foo() { System.out.print(quot;Bfoo quot;); }
-
public static void main(String[] args) {
-
Alpha a = new Beta();
-
Beta b = (Beta)a;
-
a.foo();
-
b.foo();
21. }
22. }
What is the result?
-
Afoo Afoo
-
Afoo Bfoo
-
Bfoo Afoo
-
Bfoo Bfoo
-
Compilation fails.
-
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?
-
Compilation will succeed for all classes and interfaces.
-
Compilation of class C will fail because of an error in line 2.
-
Compilation of class C will fail because of an error in line 6.
-
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.)
-
static final int[] a = { 100,200 };
-
static final int[] a;
static { a=new int[2]; a[0]=100; a[1]=200; }
-
static final int[] a = new int[2]{ 100,200 };
-
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:
-
interface Foo { int bar(); }
-
public class Sprite {
-
public int fubar( Foo foo ) { return foo.bar(); }
-
public void testFoo() {
-
fubar(
-
// insert code here 16. );
17. }
18. }
Which code, inserted at line 15, allows the class Sprite to compile?
-
Foo { public int bar() { return 1; }
-
new Foo { public int bar() { return 1; }
-
new Foo() { public int bar() { return 1; }
-
new class Foo { public int bar() { return 1; }
Answer: C
Question No: 16 – (Topic 1)
Given:
-
class Alligator {
-
public static void main(String[] args) { 3. int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}};
-
4. int [][]y = x;
-
System.out.println(y[2][1]); 6. }
7. }
What is the result?
-
2
-
3
-
4
-
6
-
7
-
Compilation fails.
-
Answer: E
Question No: 17 – (Topic 1)
Given:
22. StringBuilder sb1 = new StringBuilder(quot;123quot;);
23. String s1 = quot;123quot;;
-
// insert code here
-
System.out.println(sb1 quot; quot; s1);
Which code fragment, inserted at line 24, outputs quot;123abc 123abcquot;?
-
sb1.append(quot;abcquot;); s1.append(quot;abcquot;);
-
sb1.append(quot;abcquot;); s1.concat(quot;abcquot;);
-
sb1.concat(quot;abcquot;); s1.append(quot;abcquot;);
-
sb1.concat(quot;abcquot;); s1.concat(quot;abcquot;);
-
sb1.append(quot;abcquot;); s1 = s1.concat(quot;abcquot;);
-
sb1.concat(quot;abcquot;); s1 = s1.concat(quot;abcquot;);
-
sb1.append(quot;abcquot;); s1 = s1 s1.concat(quot;abcquot;);
-
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:
-
import java.io.*;
-
public class DOS {
-
public static void main(String[] args) {
-
File dir = new File(quot;dirquot;);
-
dir.mkdir();
-
File f1 = new File(dir, quot;f1.txtquot;);
-
try {
-
f1.createNewFile();
-
} catch (IOException e) { ; }
-
File newDir = new File(quot;newDirquot;);
-
dir.renameTo(newDir);
22. }
23. }
Which statement is true?
-
Compilation fails.
-
The file system has a new empty directory named dir.
-
The file system has a new empty directory named newDir.
-
The file system has a directory named dir, containing a file f1.txt.
-
The file system has a directory named newDir, containing a file f1.txt.
Answer: E
Question No: 19 – (Topic 1)
Given:
-
class Converter {
-
public static void main(String[] args) {
-
Integer i = args[0];
-
int j = 12;
-
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?
-
It is true that j==i.
-
It is false that j==i.
-
An exception is thrown at runtime.
-
Compilation fails because of an error in line 13.
Answer: D
Question No: 20 – (Topic 1)
Given:
-
String test = quot;Test A. Test B. Test C.quot;;
-
// insert code here
-
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;?
-
String regex = quot;quot;;
-
String regex = quot; quot;;
-
String regex = quot;.*quot;;
-
String regex = quot;\\squot;;
-
String regex = quot;\\.\\s*quot;;
-
String regex = quot;\\w[ \.] quot;;
Answer: E
100% Ensurepass Free Download!
–Download Free Demo:1z0-851 Demo PDF
100% Ensurepass Free Guaranteed!
–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 |
100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF