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: 31 – (Topic 1)
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.
-
Compilation fails.
-
An exception is thrown at runtime.
Answer: D
Question No: 32 – (Topic 1)
Click the Exhibit button. What is the result?
-
first second third snootchy 420
-
snootchy 420 first second third
-
third first second snootchy 420
-
first second first third snootchy 420
-
snootchy 420 third second first
-
third second first snootchy 420
Answer: F
Question No: 33 – (Topic 1)
Given:
-
public class TestOne implements Runnable {
-
public static void main (String[] args) throws Exception {
-
Thread t = new Thread(new TestOne());
-
t.start();
-
System.out.print(quot;Startedquot;);
-
t.join();
-
System.out.print(quot;Completequot;); 8. }
-
9. public void run() {
10. for (int i = 0; i lt; 4; i ) {
11. System.out.print(i);
12. }
13. }
14. }
What can be a result?
-
The code executes and prints quot;StartedCompletequot;.
-
Compilation fails.
-
The code executes and prints quot;Started0123Completequot;.
-
The code executes and prints quot;StartedComplete0123quot;.
-
An exception is thrown at runtime.
Answer: C
Question No: 34 – (Topic 1)
Given:
-
import java.util.*;
-
public class WrappedString {
-
private String s;
-
public WrappedString(String s) { this.s = s; }
-
public static void main(String[] args) {
-
HashSetlt;Objectgt; hs = new HashSetlt;Objectgt;();
-
WrappedString ws1 = new WrappedString(quot;aardvarkquot;);
-
WrappedString ws2 = new WrappedString(quot;aardvarkquot;);
-
String s1 = new String(quot;aardvarkquot;);
-
String s2 = new String(quot;aardvarkquot;);
-
hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2);
-
System.out.println(hs.size()); } } What is the result?
-
-
Compilation fails.
-
1
-
4
-
2
-
0
-
An exception is thrown at runtime.
-
3
Answer: G
Question No: 35 – (Topic 1)
Given:
-
// some code here
-
try {
-
// some code here
-
} catch (SomeException se) {
-
// some code here
-
} finally {
-
// some code here
38. }
Under which three circumstances will the code on line 37 be executed? (Choose three.)
-
The code on line 33 executes successfully.
-
The code on line 33 throws an exception.
-
The instance gets garbage collected.
-
The code on line 31 throws an exception.
-
The code on line 35 throws an exception.
Answer: A,B,E
Question No: 36 – (Topic 1)
Given:
-
public static void main(String[] args) {
-
try {
-
args = null;
-
args[0] = quot;testquot;;
-
System.out.println(args[0]);
-
} catch (Exception ex) {
-
System.out.println(quot;Exceptionquot;);
-
} catch (NullPointerException npe) {
-
System.out.println(quot;NullPointerExceptionquot;);
20. }
21. }
What is the result?
-
test
-
NullPointerException
-
Exception
-
Compilation fails.
Answer: D
Question No: 37 DRAG DROP – (Topic 1)
Click the Task button.
Answer:
Question No: 38 DRAG DROP – (Topic 1)
Click the Task button.
Answer:
Question No: 39 – (Topic 1)
Given a pre-generics implementation of a method:
-
public static int sum(List list) {
-
int sum = 0;
-
for ( Iterator iter = list.iterator(); iter.hasNext(); ) {
-
int i = ((Integer)iter.next()).intValue();
-
sum = i;
16. }
17. return sum;
18. }
Which three changes must be made to the method sum to use generics? (Choose three.)
-
replace line 13 with quot;for (int i : intList) {quot;
-
replace the method declaration with quot;sum(Listlt;intgt; intList)quot;
-
replace the method declaration with quot;sum(Listlt;Integergt; intList)quot;
-
replace line 14 with quot;int i = iter.next();quot;
-
replace line 13 with quot;for (Iterator iter : intList) {quot;
-
remove line 14
Answer: A,C,F
Question No: 40 – (Topic 1)
Given:
-
public class Threads5 {
-
public static void main (String[] args) {
-
new Thread(new Runnable() {
-
public void run() {
-
System.out.print(quot;barquot;); 6. }}).start();
7. }
8. }
What is the result?
-
Compilation fails.
-
An exception is thrown at runtime.
-
The code executes normally, but nothing prints.
-
The code executes normally and prints quot;barquot;.
Answer: D
100% Ensurepass Free Download!
–Download Free Demo:1z0-853 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-853 DumpsEnsurePass 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 HOT CATEGORY!HOT EXAM!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
-
-