Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-853
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-853.html
Java Standard Edition 5 Programmer Certified Professional Exam
Question No: 101 – (Topic 2)
Given:
-
import java.io.*;
-
public class Forest implements Serializable {
-
private Tree tree = new Tree();
-
public static void main(String [] args) {
-
Forest f = new Forest();
-
try {
-
FileOutputStream fs = new FileOutputStream(quot;Forest.serquot;);
-
ObjectOutputStream os = new ObjectOutputStream(fs);
-
os.writeObject(f); os.close();
-
} catch (Exception ex) { ex.printStackTrace(); } 22. } }
23.
24. class Tree { } What is the result?
-
An instance of Forest is serialized.
-
Compilation fails.
-
An exception is thrown at runtime.
-
An instance of Forest and an instance of Tree are both serialized.
Answer: C
Question No: 102 – (Topic 2)
Which two statements are true about the hashCode method? (Choose two.)
-
The hashCode method for a given class can be used to test for object equality and object inequality for that class.
-
The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.
-
The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.
-
The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set.
-
The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.
Answer: B,E
Question No: 103 – (Topic 2)
Given:
-
public class Wow {
-
public static void go(short n) {System.out.println(quot;shortquot;);}
-
public static void go(Short n) {System.out.println(quot;SHORTquot;);}
-
public static void go(Long n) {System.out.println(quot; LONGquot;);}
-
public static void main(String [] args) {
-
Short y = 6;
-
int z = 7;
-
go(y);
-
go(z);
21. }
22. }
What is the result?
-
short LONG
-
Compilation fails.
-
SHORT LONG
-
An exception is thrown at runtime.
Answer: B
Question No: 104 – (Topic 2)
Given:
-
public class Person {
-
private name;
-
public Person(String name) {
-
this.name = name;
15. }
-
public int hashCode() {
-
return 420;
18. }
19. }
Which statement is true?
-
Deleting a Person key from a HashMap will delete all map entries for all keys of type Person.
-
The time to find the value from HashMap with a Person key depends on the size of the map.
-
The time to determine whether a Person object is contained in a HashSet is constant and does NOT depend on the size of the map.
-
Inserting a second Person object into a HashSet will cause the first Person object to be removed as a duplicate.
Answer: B
Question No: 105 – (Topic 2)
Given:
-
import java.io.*;
-
public class Forest implements Serializable {
-
private Tree tree = new Tree();
-
public static void main(String [] args) {
-
Forest f = new Forest();
-
try {
-
FileOutputStream fs = new FileOutputStream(quot;Forest.serquot;);
-
ObjectOutputStream os = new ObjectOutputStream(fs);
-
os.writeObject(f); os.close();
-
} catch (Exception ex) { ex.printStackTrace(); } 22. } }
23.
24. class Tree { } What is the result?
-
An instance of Forest and an instance of Tree are both serialized.
-
An instance of Forest is serialized.
-
An exception is thrown at runtime.
-
Compilation fails.
Answer: C
Question No: 106 DRAG DROP – (Topic 2)
Click the Task button.
Answer:
Question No: 107 – (Topic 2)
Given:
-
class Pizza {
-
java.util.ArrayList toppings;
-
public final void addTopping(String topping) {
-
toppings.add(topping); 5. }
-
6. }
-
public class PepperoniPizza extends Pizza {
-
public void addTopping(String topping) {
-
System.out.println(quot;Cannot add Toppingsquot;);
10. }
-
public static void main(String[] args) {
-
Pizza pizza = new PepperoniPizza();
-
pizza.addTopping(quot;Mushroomsquot;);
14. }
15. }
What is the result?
-
The code runs with no output.
-
Cannot add Toppings
-
A NullPointerException is thrown in Line 4.
-
Compilation fails.
Answer: D
Question No: 108 – (Topic 2)
Given:
11. public static void main(String[] args) { 12. for (int i = 0; i lt;= 10; i ) {
13. if (i gt; 6) break;
14. }
15. System.out.println(i);
16. }
What is the result?
-
Compilation fails.
-
10
-
7
-
6
-
11
-
An exception is thrown at runtime.
Answer: A
Question No: 109 – (Topic 2)
Given:
-
interface Data { public void load(); }
-
abstract class Info { public abstract void load(); }
Which class correctly uses the Data interface and Info class?
-
public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ }
public void Info.load() { /*do something*/ }
}
-
public class Employee extends Info implements Data public void load(){ /*do something*/ }
public void Info.load(){ /*do something*/ }
}
-
public class Employee extends Info implements Data { public void load() { /*do something*/ }
}
-
public class Employee implements Info extends Data { public void Data.load(){ /*do something*/ }
public void load(){ /*do something*/ }
}
-
public class Employee implements Info extends Data { public void load() { /*do something*/ }
}
-
public class Employee implements Info extends Data { public void load(){ /*do something*/ }
public void Info.load(){ /*do something*/ }
}
Answer: C
Question No: 110 – (Topic 2)
Given:
-
public static void parse(String str) {
-
try {
-
float f = Float.parseFloat(str);
-
} catch (NumberFormatException nfe) { 15. f = 0;
-
} finally {
-
System.out.println(f);
18. }
19. }
-
public static void main(String[] args) {
-
parse(quot;invalidquot;);
22. }
What is the result?
-
A NumberFormatException is thrown by the parse method at runtime.
-
A ParseException is thrown by the parse method at runtime.
-
Compilation fails.
D. 0.0
Answer: C
100% Ensurepass Free Download!
–Download Free Demo:1z0-853 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-853 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