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: 181 – (Topic 2)
Given:
-
package com.company.application; 2.
-
public class MainClass {
-
public static void main(String[] args) {} 5. }
And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to quot;.quot; (current directory).
Which two java commands entered at the command line will run MainClass? (Choose two.)
-
java -classpath /apps/com/company/application:. MainClass if run from the /apps directory
-
java -classpath . MainClass if run from the /apps/com/company/application directory
-
java -classpath /apps com.company.application.MainClass if run from any directory
-
java MainClass if run from the /apps directory
-
java com.company.application.MainClass if run from the /apps directory
-
java com.company.application.MainClass if run from the /apps/com/company/application directory
Answer: C,E
Question No: 182 – (Topic 2)
Given:
-
public class Target {
-
private int i = 0;
-
public int addOne(){
-
return i; 5. }
-
-
6. }
And:
-
public class Client {
-
public static void main(String[] args){
-
System.out.println(new Target().addOne()); 4. }
5. }
Which change can you make to Target without affecting Client?
-
Line 3 of class Target can be changed to private int addOne(){
-
Line 2 of class Target can be changed to private Integer i = 0;
-
Line 4 of class Target can be changed to return i ;
-
Line 2 of class Target can be changed to private int i = 1;
-
Answer: B
Question No: 183 – (Topic 2)
Given:
-
public void genNumbers() {
-
ArrayList numbers = new ArrayList(); 13. for (int i=0; ilt;10; i ) {
-
int value = i * ((int) Math.random());
-
Integer intObj = new Integer(value);
-
numbers.add(intObj);
17. }
18. System.out.println(numbers);
19. }
Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?
-
The object is NOT a candidate for garbage collection.
-
Line 18
-
Line 19
-
Line 16
-
Line 17
Answer: C
Question No: 184 – (Topic 2)
Click the Exhibit button. What is the result?
-
Compilation fails.
-
Value is: -12
-
Value is: 8
-
The code runs with no output.
-
Value is: 12
-
An exception is thrown at runtime.
Answer: C
Question No: 185 – (Topic 2)
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;Started0123Completequot;.
-
An exception is thrown at runtime.
-
Compilation fails.
-
The code executes and prints quot;StartedCompletequot;.
-
The code executes and prints quot;StartedComplete0123quot;.
Answer: A
Question No: 186 – (Topic 2)
Given: 1. public class TestString3 { 2. public static void main(String[] args) { 3. // insert code here 5. System.out.println(s); 6. } 7. } Which two code fragments, inserted independently at line 3, generate the output 4247? (Choose two.)
A. StringBuilder s = new StringBuilder(quot;123456789quot;);
B. delete(0,3).delete(1,3).delete(2,5).insert(1, quot;24quot;);
C. StringBuffer s = new StringBuffer(quot;123456789quot;);
D. delete(0,3).replace(1,3,quot;24quot;).delete(4,6);
E. String s = quot;123456789quot;;
s = (s-quot;123quot;).replace(1,3,quot;24quot;) – quot;89quot;;
-
StringBuilder s = new StringBuilder(quot;123456789quot;);
-
substring(3,6).delete(1,2).insert(1, quot;24quot;);
-
StringBuffer s = new StringBuffer(quot;123456789quot;);
-
substring(3,6).delete(1,3).insert(1, quot;24quot;);
Answer: A,B
Question No: 187 – (Topic 2)
Which three statements concerning the use of the java.io.Serializable interface are true? (Choose three.)
-
The values in fields with the transient modifier will NOT survive serialization and deserialization.
-
The values in fields with the volatile modifier will NOT survive serialization and deserialization.
-
An object serialized on one JVM can be successfully deserialized on a different JVM.
-
It is legal to serialize an object of a type that has a supertype that does NOT implement java.io.Serializable.
-
Objects from classes that use aggregation cannot be serialized.
Answer: A,C,D
Question No: 188 – (Topic 2)
Given:
-
interface DeclareStuff {
-
public static final int EASY = 3;
-
void doStuff(int t); }
-
public class TestDeclare implements DeclareStuff {
-
public static void main(String [] args) {
-
int x = 5;
-
new TestDeclare().doStuff( x);
18. }
-
void doStuff(int s) {
-
s = EASY s;
-
System.out.println(quot;s quot; s);
22. }
23. }
What is the result?
-
s 10
-
s 16
-
An exception is thrown at runtime.
-
Compilation fails.
-
s 14
Answer: D
Question No: 189 – (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?
-
An exception is thrown at runtime.
-
some
-
zero
-
Compilation fails.
-
null
Answer: D
Question No: 190 – (Topic 2)
Given:
-
interface Foo {}
-
class Alpha implements Foo {}
-
class Beta extends Alpha {}
-
class Delta extends Beta {
-
public static void main( String[] args ) {
-
Beta x = new Beta();
-
// insert code here
17. }
18. }
Which code, inserted at line 16, will cause a java.lang.ClassCastException?
-
Beta b = (Beta)(Alpha)x;
-
Foo f = (Alpha)x;
-
Alpha a = x;
-
Foo f = (Delta)x;
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