High quality of 1Z0-804 free practice questions materials and guidance for Oracle certification for IT engineers, Real Success Guaranteed with Updated 1Z0-804 pdf dumps vce Materials. 100% PASS Java SE 7 Programmer II Exam exam Today!

Q17. Given: 

What is the result? 

A. Nice to see you,be fine 

B. Nice,see you,be fine 

C. Nice,see you, to, be fine 

D. Nice, see you, be fine 

E. Nice to see y, u, be fine 

Answer:

Explanation: 

The text ",to," is replaced by the "," 


Q18. Given: 

Which two statements, inserted independently at line ***, enable the program to produce the following output: 

We have 002 Blue pants that cost $24.99. 

A. System.out.printf("We have %03d %s pants that cost $%3.2f.\n",quantity, color, price); 

B. System.out.printf("We have$03d$s pants that cost $$3.2f.\n",quantity, color, price); 

C. String out = String.format ("We have %03d %s pants that cost $%3.2f.\n",quantity, 

color,price); 

System.out.println(out); 

D. String out = System.out.format("We have %03d %s pants that cost $%3.2f.",quantity, 

color, price); 

System.out.println(out); 

E. System.out.format("We have %s%spants that cost $%s.\n",quantity, color, price); 

Answer: A,C 


Q19. Which two are true about Singletons? 

A. A Singleton must implement serializable. 

B. A Singleton has only the default constructor. 

C. A Singleton implements a factory method. 

D. A Singleton improves a class's cohesion. 

E. Singletons can be designed to be thread-safe. 

Answer: C,E 


Q20. Given the cache class: 

A. 101 

B. Compilation fails at line 1. 

C. Compilation fails at line 2. 

D. Compilation fails at line 3. 

Answer:

Explanation: 

Compilation failure at line:1 Incorrect number of arguments for type Cache<T>; it cannot be parameterized with arguments <>illegal start of typetype cache.Cache does not take parameters. 


Q21. Given: 

Which two classes correctly override the getDepth method? 

A. public class deep extends Deeper { 

protected Integer getDepth(){ 

return 5; 

}} 

B. public class deep extends Deeper { 

public Double getDepth() { 

return 5d; 

}} 

C. public class deep extends Deeper { 

public String getDepth () { 

}} 

D. public class deep extends Deeper { 

public Long getDepth (int d) { 

return 5L; 

}} 

E. public class deep extends Deeper { 

public Short getDepth () { 

return 5; 

}} 

Answer: A,E 

Explanation: 

Note: The abstract class Number is the superclass of classes Byte, Double, Float, Integer, Long, and Short. 

Subclasses of Number must provide methods to convert the represented numeric value to byte, double, float, int, long, and short. 

When class C extends B, we say that C is a "subclass" of B, and B is the "superclass" of C. This is called inheritence, because C inherited from B. 


Q22. Given: 

From what threading problem does the program suffer? 

A. deadlock 

B. livelock 

C. starvation D. race condition 

Answer:

Explanation: 

A thread often acts in response to the action of another thread. If the other thread's action is also a response tothe action of another thread, then livelock may result. As with deadlock, livelocked threads are unable to makefurther progress. 

However, the threads are not blocked -- they are simply too busy responding to each other to resume work. This is comparable to two people attempting to pass each other in a corridor: Alphonse moves to his left to let Gaston pass, while Gaston moves to his right to let Alphonse pass. Seeing that they are still blocking eachother, Alphone moves to his right, while Gaston moves to his left. They'restill blocking each other, so. 


Q23. Given: 

What is the result? 

A. Daniel 

B. Unknown 

C. It may print"unknown"or"Daniel"depending on the JVM implementation. 

D. Compilation fails. 

E. An exception is thrown at runtime. 

Answer:

Explanation: 

The compilation fails at line start(); Erstellen eines statischen Verweises auf die nicht statische Methode start() vom Typ Runner nicht m.glich.Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - non-static method start()cannot be referenced from a static context 


Q24. Given the code fragment: 

What is the result, if the file salesreport.dat does not exist? 

A. Compilation fails only at line 6 

B. Compilation fails only at line 13 

C. Compilation fails at line 6 and 13 

D. Class java.io.IOException 

E. Class java.io.FileNotFoundException 

Answer:

Explanation: 

Compilation fails Line 13 : The resource br of a try-with-resources statement cannot be assignedresources are final in try-with-resources statements