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: 181 – (Topic 2)
Given:
-
public static void main(String[] args) {
-
String str = quot;nullquot;;
-
if (str == null) {
-
System.out.println(quot;nullquot;);
-
} else (str.length() == 0) {
-
System.out.println(quot;zeroquot;);
-
} else {
-
System.out.println(quot;somequot;);
19. }
20. }
What is the result?
-
null
-
zero
-
some
-
Compilation fails.
-
An exception is thrown at runtime.
Answer: D
Question No: 182 – (Topic 2)
Given:
-
public class Mule {
-
public static void main(String[] args) {
-
boolean assert = true;
-
if(assert) {
-
System.out.println(quot;assert is truequot;); 6. }
7. }
8. }
Which command-line invocations will compile?
-
javac Mule.java
-
javac -source 1.3 Mule.java
-
javac -source 1.4 Mule.java
-
javac -source 1.5 Mule.java
-
-
Answer: B
Question No: 183 – (Topic 2)
Given:
-
static void test() {
-
try {
-
String x = null;
-
System.out.print(x.toString() quot; quot;);
15. }
16. finally { System.out.print(quot;finally quot;); }
17. }
-
public static void main(String[] args) {
-
try { test(); }
-
catch (Exception ex) { System.out.print(quot;exception quot;); }
21. }
What is the result?
-
null
-
finally
-
null finally
-
Compilation fails.
-
finally exception
Answer: E
Question No: 184 – (Topic 2)
Given:
-
public class Boxer1{
-
Integer i;
-
int x;
-
public Boxer1(int y) {
-
x = i y;
-
System.out.println(x); 7. }
-
-
public static void main(String[] args) {
-
new Boxer1(new Integer(4));
10. }
11. }
What is the result?
-
The value quot;4quot; is printed at the command line.
-
Compilation fails because of an error in line 5.
-
Compilation fails because of an error in line 9.
-
A NullPointerException occurs at runtime.
-
A NumberFormatException occurs at runtime.
-
An IllegalStateException occurs at runtime.
-
Answer: D
Question No: 185 – (Topic 2)
Which two code fragments are most likely to cause a StackOverflowError? (Choose two.)
A. int []x = {1,2,3,4,5};
for(int y = 0; y lt; 6; y ) System.out.println(x[y]); B. static int[] x = {7,6,5,4}; static { x[1] = 8;
x[4] = 3; }
C. for(int y = 10; y lt; 10; y ) doStuff(y);
D. void doOne(int x) { doTwo(x); } void doTwo(int y) { doThree(y); } void doThree(int z) { doTwo(z); }
E. for(int x = 0; x lt; 1000000000; x ) doStuff(x);
F. void counter(int i) { counter( i); }
Answer: D,F
Question No: 186 – (Topic 2)
Given:
-
static void test() throws RuntimeException {
-
try {
-
System.out.print(quot;test quot;);
-
throw new RuntimeException();
15. }
16. catch (Exception ex) { System.out.print(quot;exception quot;); }
17. }
-
public static void main(String[] args) {
-
try { test(); }
-
catch (RuntimeException ex) { System.out.print(quot;runtime quot;); }
-
System.out.print(quot;end quot;);
22. }
What is the result?
-
test end
-
Compilation fails.
-
test runtime end
-
test exception end
-
A Throwable is thrown by main at runtime.
Answer: D
Question No: 187 – (Topic 2)
Given:
-
public static void main(String[] args) {
-
Integer i = new Integer(1) new Integer(2);
-
switch(i) {
-
case 3: System.out.println(quot;threequot;); break;
-
default: System.out.println(quot;otherquot;); break;
16. }
17. }
What is the result?
-
three
-
other
-
An exception is thrown at runtime.
-
Compilation fails because of an error on line 12.
-
Compilation fails because of an error on line 13.
-
Compilation fails because of an error on line 15.
Answer: A
Question No: 188 – (Topic 2)
Given:
-
class Money {
-
private String country = quot;Canadaquot;;
-
public String getC() { return country; }
24. }
-
class Yen extends Money {
-
public String getC() { return super.country; }
27. }
-
public class Euro extends Money {
-
public String getC(int x) { return super.getC(); }
-
public static void main(String[] args) {
-
System.out.print(new Yen().getC() quot; quot; new Euro().getC());
32. }
33. }
What is the result?
-
Canada
-
null Canada
-
Canada null
-
Canada Canada
-
Compilation fails due to an error on line 26.
-
Compilation fails due to an error on line 29.
Answer: E
Question No: 189 – (Topic 2)
Given:
-
class ClassA {}
-
class ClassB extends ClassA {}
-
class ClassC extends ClassA {} and:
-
ClassA p0 = new ClassA();
-
ClassB p1 = new ClassB();
-
ClassC p2 = new ClassC();
-
ClassA p3 = new ClassB();
-
ClassA p4 = new ClassC();
Which three are valid? (Choose three.)
-
p0 = p1;
-
p1 = p2;
-
p2 = p4;
-
p2 = (ClassC)p1;
-
p1 = (ClassB)p3;
-
p2 = (ClassC)p4;
Answer: A,E,F
Question No: 190 – (Topic 2)
Which three statements are true? (Choose three.)
-
A final method in class X can be abstract if and only if X is abstract.
-
A protected method in class X can be overridden by any subclass of X.
-
A private static method can be called only within other static methods in class X.
-
A non-static public final method in class X can be overridden in any subclass of X.
-
A public static method in class X can be called by a subclass of X without explicitly referencing the class X.
-
A method with the same signature as a private final method in class X can be implemented in a subclass of X.
-
A protected method in class X can be overridden by a subclass of X only if the subclass is in the same package as X.
Answer: B,E,F
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