Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-852
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-852.html
Java Standard Edition 6 Programmer Certified Professional Upgrade Exam
Question No: 31
Given:
-
public class Breaker2 {
-
static String o = quot;quot;;
-
public static void main(String[] args) {
-
z:
5. for(int x = 2; x lt; 7; x ) {
-
if(x==3) continue;
-
if(x==5) break z;
-
o = o x;
9. }
10. System.out.println(o);
11. }
12. }
What is the result?
-
2
-
24 C. 234 D. 246 E. 2346
F. Compilation fails.
Answer: B
Question No: 32
Given:
-
try {
-
// some code here
-
} catch (NullPointerException e1) {
-
System.out.print(quot;aquot;);
-
} catch (Exception e2) {
-
System.out.print(quot;bquot;);
-
} finally {
-
System.out.print(quot;cquot;);
41. }
If some sort of exception is thrown at line 34, which output is possible?
-
a
-
b
-
c
-
ac
-
abc
Answer: D
Question No: 33
Given:
-
public void go(int x) {
-
assert (x gt; 0);
-
switch(x) {
-
case 2: ;
-
default: assert false;
16. }
17. }
18. private void go2(int x) { assert (x lt; 0); } Which statement is true?
-
All of the assert statements are used appropriately.
-
Only the assert statement on line 12 is used appropriately.
-
Only the assert statement on line 15 is used appropriately.
-
Only the assert statement on line 18 is used appropriately.
-
Only the assert statements on lines 12 and 15 are used appropriately.
-
Only the assert statements on lines 12 and 18 are used appropriately.
-
Only the assert statements on lines 15 and 18 are used appropriately.
Answer: G
Question No: 34
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: 35
Given:
11. class X { public void foo() { System.out.print(quot;X quot;); } } 12.
-
public class SubB extends X {
-
public void foo() throws RuntimeException {
-
super.foo();
-
if (true) throw new RuntimeException();
-
System.out.print(quot;B quot;);
18. }
-
public static void main(String[] args) {
-
new SubB().foo();
21. }
22. }
What is the result?
-
X, followed by an Exception.
-
No output, and an Exception is thrown.
-
Compilation fails due to an error on line 14.
-
Compilation fails due to an error on line 16.
-
Compilation fails due to an error on line 17.
-
X, followed by an Exception, followed by B.
Answer: A
Question No: 36
Given:
-
public class Breaker {
-
static String o = quot;quot;;
-
public static void main(String[] args) {
-
z:
7. o = o 2;
8. for(int x = 3; x lt; 8; x ) {
-
if(x==4) break;
-
if(x==6) break z;
-
o = o x;
12. }
13. System.out.println(o);
14. }
15. }
What is the result?
A. 23 B. 234 C. 235 D. 2345 E. 2357
F. 23457
G. Compilation fails.
Answer: G
Question No: 37
Which three will compile and run without exception? (Choose three.)
-
private synchronized Object o;
-
void go() {
synchronized() { /* code here */ }
}
-
public synchronized void go() { /* code here */ }
-
private synchronized(this) void go() { /* code here */ }
-
void go() {
synchronized(Object.class) { /* code here */ }
}
-
void go() {
Object o = new Object(); synchronized(o) { /* code here */ }
}
Answer: C,E,F
Question No: 38
Given:
-
public class PingPong implements Runnable {
-
synchronized void hit(long n) {
13. for(int i = 1; i lt; 3; i )
14. System.out.print(n quot;-quot; i quot; quot;);
15. }
-
public static void main(String[] args) {
-
new Thread(new PingPong()).start();
-
new Thread(new PingPong()).start();
19. }
-
public void run() {
-
hit(Thread.currentThread().getId());
22. }
23. }
Which two statements are true? (Choose two.)
-
The output could be 8-1 7-2 8-2 7-1
-
The output could be 7-1 7-2 8-1 6-1
-
The output could be 8-1 7-1 7-2 8-2
-
The output could be 8-1 8-2 7-1 7-2
Answer: C,D
Question No: 39
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?
-
Compilation fails.
-
An exception is thrown at runtime.
-
The code executes and prints quot;StartedCompletequot;.
-
The code executes and prints quot;StartedComplete0123quot;.
-
The code executes and prints quot;Started0123Completequot;.
Answer: E
Question No: 40 DRAG DROP
Click the Task button.
Answer:
100% Ensurepass Free Download!
–Download Free Demo:1z0-852 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-852 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