Downloadable of 1Z0-852 question materials and rapidshare for Oracle certification for IT examinee, Real Success Guaranteed with Updated 1Z0-852 pdf dumps vce Materials. 100% PASS Java Standard Edition 6 Programmer Certified Professional Upgrade Exam exam Today!

2016 Oct 1Z0-852 free practice questions

Q21. Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?(Choose two.) 

A. When using versions of Java technology earlier than 5.0. 

B. When sharing a StringBuffer among multiple threads. 

C. When using the java.io class StringBufferInputStream. 

D. When you plan to reuse the StringBuffer to build more than one string. 

Answer: A,B 

Explanation: 

83. Given: 

1.

 public class LineUp { 

2.

 public static void main(String[] args) { 

3.

 double d = 12.345; 

4.

 // insert code here 

5.

 } 

6.

 } 

Which code fragment, inserted at line 4, produces the output | 12.345|? 

A. System.out.printf("|%7d| \n", d); 

B. System.out.printf("|%7f| \n", d); 

C. System.out.printf("|%3.7d| \n", d); 

D. System.out.printf("|%3.7f| \n", d); 

E. System.out.printf("|%7.3d| \n", d); 

F. System.out.printf("|%7.3f| \n", d); 

Answer:

Explanation: 


Q22. A company has a business application that provides its users with many different reports: receivables reports, payables reports, revenue projects, and so on. The company has just purchased some new, state-of-the-art, wireless printers, and a programmer has been assigned the task of enhancing all of the reports to use not only the company's old printers, but the new wireless printers as well. When the programmer starts looking into the application, the programmer discovers that because of the design of the application, it is necessary to make changes to eachreport to support the new printers. Which two design concepts most likely explain this situation? (Choose two.) 

A. Inheritance 

B. Low cohesion 

C. Tight coupling 

D. High cohesion 

E. Loose coupling 

F. Object immutability 

Answer: B,C 

Explanation: 


Q23. Given a method that must ensure that its parameter is not null: 

11.

 public void someMethod(Object value) { 

12.

 // check for null value ... 

20.

 System.out.println(value.getClass()); 

21.

 } 

What, inserted at line 12, is the appropriate way to handle a null value? 

A. assert value == null; 

B. assert value != null, "value is null"; 

C. if (value == null) { 

throw new AssertionException("value is null"); 

D. if (value == null) { 

throw new IllegalArgumentException("value is null"); 

Answer:

Explanation: 


Q24. Given: 

3.

 import java.util.*; 

4.

 public class Hancock { 

5.

 // insert code here 

6.

 list.add("foo"); 

7.

 } 

8.

 } 

Which two code fragments, inserted independently at line 5, will compile without warnings? (Choose two.) 

A. public void addStrings(List list) { 

B. public void addStrings(List<String> list) { 

C. public void addStrings(List<? super String> list) { 

D. public void addStrings(List<? extends String> list) { 

Answer: B,C 

Explanation: 

57. Given: 

22.

 public void go() { 

23.

 String o = ""; 

24.

 z: 

25.

 for(int x = 0; x < 3; x++) { 

26.

 for(int y = 0; y < 2; y++) { 

27.

 if(x==1) break; 

28.

 if(x==2 && y==1) break z; 

29.

 o = o + x + y; 

30.

 } 

31.

 } 

32.

 System.out.println(o); 

33.

 } 

What is the result when the go() method is invoked? 

A. 00 

B. 0001 

C. 000120 

D. 00012021 

E. Compilation fails. 

F. An exception is thrown at runtime. 

Answer:

Explanation: 


Q25. Given: 

11.

 public class Commander { 

12.

 public static void main(String[] args) { 

13.

 String myProp = /* insert code here */ 

14.

 System.out.println(myProp); 

15.

 } 

16.

 } 

and the command line: 

java -Dprop.custom=gobstopper Commander 

Which two, placed on line 13, will produce the output gobstopper? (Choose two.) 

A. System.load("prop.custom"); 

B. System.getenv("prop.custom"); 

C. System.property("prop.custom"); 

D. System.getProperty("prop.custom"); 

E. System.getProperties().getProperty("prop.custom"); 

Answer: D,E 

Explanation: 


Down to date 1Z0-852 test:

Q26. Which capability exists only in java.io.FileWriter? 

A. Closing an open stream. B. Flushing an open stream. C. Writing to an open stream. 

D. Writing a line separator to an open stream. 

Answer:

Explanation: 


Q27. Given: 

5.

 class A { 

6.

 void foo() throws Exception { throw new Exception(); } 

7.

 } 

8.

 class SubB2 extends A { 

9.

 void foo() { System.out.println("B "); } 

10.

 } 

11.

 class Tester { 

12.

 public static void main(String[] args) { 

13.

 A a = new SubB2(); 

14.

 a.foo(); 

15.

 } 

16.

 } 

What is the result? 

A. B 

B. B, followed by an Exception. 

C. Compilation fails due to an error on line 9. D. Compilation fails due to an error on line 14. E. An Exception is thrown with no other output. 

Answer:

Explanation: 


Q28. Given: 

11.

 public class Yikes { 

12. 

13.

 public static void go(Long n) {System.out.print("Long ");} 

14.

 public static void go(Short n) {System.out.print("Short ");} 

15.

 public static void go(int n) {System.out.print("int ");} 

16.

 public static void main(String [] args) { 

17.

 short y = 6; 

18.

 long z = 7; 

19.

 go(y); 

20.

 go(z); 21. } 

22. } 

What is the result? 

A. int Long 

B. Short Long 

C. Compilation fails. 

D. An exception is thrown at runtime. 

Answer:

Explanation: 


Q29. Given a valid DateFormat object named df, and 

16.

 Date d = new Date(0L); 

17.

 String ds = "December 15, 2004"; 

18.

 // insert code here 

What updates d's value with the date represented by ds? 

A. 18. d = df.parse(ds); 

B. 18. d = df.getDate(ds); 

C. 18. try { 

19.

 d = df.parse(ds); 

20.

 } catch(ParseException e) { }; 

D. 18. try { 

19.

 d = df.getDate(ds); 

20.

 } catch(ParseException e) { }; 

Answer:

Explanation: 

81. Given: 

10.

 import java.io.*; 

11.

 class Animal { 

12.

 Animal() { System.out.print("a"); } 

13.

 } 

14.

 class Dog extends Animal implements Serializable { 

15.

 Dog() { System.out.print("d"); } 

16.

 } 

17.

 public class Beagle extends Dog { } 

If an instance of class Beagle is created, then Serialized, then deSerialized, what is the result? 

A. ad B. ada C. add D. adad 

E. Compilation fails. 

F. An exception is thrown at runtime. 

Answer:

Explanation: 


Q30. Given: 

11.

 // insert code here 

12.

 private N min, max; 

13.

 public N getMin() { return min; } 

14.

 public N getMax() { return max; } 

15.

 public void add(N added) { 

16.

 if (min == null || added.doubleValue() < min.doubleValue()) 

17.

 min = added; 

18.

 if (max == null || added.doubleValue() > max.doubleValue()) 

19.

 max = added; 

20.

 } 

21.

 } 

Which two, inserted at line 11, will allow the code to compile? (Choose two.) 

A. public class MinMax<?> { 

B. public class MinMax<? extends Number> 

C. public class MinMax<N extends Object> 

D. public class MinMax<N extends Number> 

E. public class MinMax<? extends Object> { 

F. 

public class MinMax<N extends Integer> { 

Answer: D,F 

Explanation: