Master the 1Z0-804 Java SE 7 Programmer II Exam content and be ready for exam day success quickly with this Pass4sure 1Z0-804 exam cram. We guarantee it!We make it a reality and give you real 1Z0-804 questions in our Oracle 1Z0-804 braindumps.Latest 100% VALID Oracle 1Z0-804 Exam Questions Dumps at below page. You can use our Oracle 1Z0-804 braindumps and pass your exam.

Q21. Given: 

Which three are true? 

A. BasicCar uses composition. 

B. SuperCar uses composition. 

C. BasicCar is-a Car. 

D. SuperCar is-a Car. 

E. SuperCar takes advantage of polymorphism 

F. BasicCar has-a Car 

Answer: B,C,E 

Explanation: 

B: The relationship modeled by composition is often referred to as the "has-a" relationship. Here SuperCarhas-a Car. 

C:The relationship modeled by inheritance is often referred to as the "is-a" relationship. Modeling an is-arelationship is called inheritance because the subclass inherits the interface and, by default, theimplementation of the superclass. Inheritance of interface guarantees that a subclass can accept all the samemessages as its superclass. A subclass object can, in fact, be used anywhere a superclass object is called for.E:The polymorphic method call allows one type to express its distinction from another, similar type, as long asthey're both derived from the same base type. This distinction is expressed through differences in behavior ofthe methods that you can call through the base class. 


Q22. Which two codes correctly represent a standard language locale code? 

A. ES 

B. FR 

C. U8 

D. Es 

E. fr 

F. u8 

Answer: A,B 

Explanation: 

Language codes are defined by ISO 639, an international standard that assigns two- and three-letter codes tomost languages of the world. Locale uses the two-letter codes to identify the target language. 


Q23. 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. 


Q24. Given this code fragment: 

Assume that the SQL query returns records. 

What is the result? 

A. Compilation fails due to error at line 17 

B. The program prints Error 

C. The program prints each record 

D. Compilation fails at line 14 

Answer:


Q25. Given three resources bundles with these values set for menu1: (the default resource bundle in US English.) 

English US Resource Bundle Menu1 = small French Resource Bundle Menu1 = petit Chinese Resource Bundle Menu1 = And given the code fragment: Locale.setDefault(new Locale("es", "ES")); // Set default to Spanish and Spain 

Locale loc1 = Locale.getDefault(); 

ResourceBundle message = ResourceBundle.getBundle("MessageBundle", loc1); 

System.out.println(message.getString("menu1")); 

What is the result? 

A. No message is printed 

B. petit 

C. small 

D. A runtime error is produced 

Answer:

Explanation: Compiles fine, but runtime error when trying to access the Spanish Resource bundle (which doesnot exist): Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name messageBundle, locale es_ES 


Q26. Given the code fragment: SimpleDataFormat sdf; 

Which code fragment displays the three-character month abbreviation? 

A. SimpleDateFormat sdf = new SimpleDateFormat ("mm", Locale.UK); System.out.println 

("Result:" + 

sdf.format(new Date())); 

B. SimpleDateFormat sdf = new SimpleDateFormat ("MM", Locale.UK); System.out.println 

("Result:" + 

sdf.format(new Date())); 

C. SimpleDateFormat sdf = new SimpleDateFormat ("MMM", Locale.UK); 

System.out.println ("Result:" + 

sdf.format(new Date())); 

D. SimpleDateFormat sdf = new SimpleDateFormat ("MMMM", Locale.UK); 

System.out.println ("Result:" + 

sdf.format(new Date())); 

Answer:


Q27. Given: 

What is the result? 

A. An exception is thrown at runtime on line 9. 

B. An exception is thrown at runtime on line 12 

C. onetwonull 

D. onetwothree 

E. twoonenull 

F. threetwoone 

Answer:

Explanation: 

addFirst void addFirst(E e) Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions. When using a capacity-restricted deque, it is generally preferable to 

use method offerFirst 

(E). 

pollLast 

E pollLast() 

Retrieves and removes the last element of this deque, or returns null if this deque is empty. 

Returns: 

the tail of this deque, or null if this deque is empty 


Q28. Given the following incorrect program: 

Which two changes make the program work correctly? 

A. Results must be retrieved from the newly created MyTask instances and combined. 

B. The threshold value must be increased so that the overhead of task creation does not dominate the cost ofcomputation. 

C. The midpoint computation must be altered so that it splits the workload in an optimal manner. 

D. The compute () method must be changed to return an Integer result. 

E. The compute () method must be enhanced to (fork) newly created tasks. 

F. The myTask class must be modified to extend RecursiveAction instead of RecursiveTask 

Answer: A,D 

Explanation: 

Note 1: A RecursiveTask is a recursive result-bearing ForkJoinTask. Note 2: The invokeAll(ForkJoinTask<?>… tasks) forks the given tasks, returning when isDone holds for eachtask or an (unchecked) exception is encountered, in which case the exception is rethrown. Note 3: Using the fork/join framework is simple. The first step is to write some code that performs a segmentof the work. Your code should look similar to this: if (my portion of the work is small enough) do the work directly else split my work into two pieces invoke the two pieces and wait for the results Wrap this code as a ForkJoinTask subclass, typically as one of its more specialized types RecursiveTask (which can return a result) or RecursiveAction. 


Q29. Given these facts about Java types in an application: 

-

Type x is a template for other types in the application. 

-

Type x implements dostuff (). 

-

Type x declares, but does NOT implement doit(). 

-

Type y declares doOther() . 

Which three are true? 

A. Type y must be an interface. 

B. Type x must be an abstract class. 

C. Type y must be an abstract class. 

D. Type x could implement or extend from Type y. 

E. Type x could be an abstract class or an interface. 

F. Type y could be an abstract class or an interface. 

Answer: B,D,F 

Explanation: 

Unlike interfaces, abstract classes can contain fields that are not static and final, and they can containimplemented methods. Such abstract classes are similar to interfaces, except that they provide a partialimplementation, leaving it to subclasses to complete the implementation. If an abstract class contains onlyabstract method declarations, it should be declared as an interface instead. 

Note: An interface in the Java programming language is an abstract type that is used to specify an interface (in thegeneric sense of the term) that classes must implement. Interfaces are declaredusing the interface keyword,and may only contain method signature and constant declarations (variable declarations that are declared tobe both static and final). An interface maynever contain method definitions. 

Note 2: an abstract class is a class that is declared abstract--it may or may not include abstract methods.Abstract classes cannot be instantiated, but they can be subclassed. An abstract method is a method that isdeclared without an implementation (without braces, and followed by a semicolon) 


Q30. Given the code fragment: 

Which two try statements, when inserted at line ***, enable the code to successfully move the file info.txt to thedestination directory, even if a file by the same name already exists in the destination directory? 

A. try (FileChannel in = new FileInputStream (source). getChannel(); FileChannel out = 

new FileOutputStream 

(dest).getChannel()) { in.transferTo(0, in.size(), out); 

B. try ( Files.copy(Paths.get(source),Paths.get(dest)); 

Files.delete (Paths.get(source)); 

C. try ( Files.copy(Paths.get(source), 

Paths.get(dest),StandardCopyOption.REPLACE_EXISTING); Files.delete 

(Paths.get(source)); 

D. try (Files.move(Paths.get(source),Paths.get(dest)); 

E. try(BufferedReader br = Files.newBufferedReader(Paths.get(source), 

Charset.forName("UTF- 8")); 

BufferedWriter bw = Files.newBufferedWriter(Paths.get(dest), Charset.forName("UTF-8")); 

String record = 

""; 

while ((record = br.readLine()) ! = null) { 

bw.write(record); 

bw.newLine(); 

Files.delete(Paths.get(source)); 

Answer: C,E 

Explanation: 

A: copies only, don’t move operation 

B,C,D (no try-with-resource !) syntax change to: try { … 

B: throws FileAlreadyExistsException 

C: correct if syntax change to : StandardCopyOption.REPLACE_EXISTING (before 

REPLACE_Existing) 

D: throws FileAlreadyExistsException 

E: works properly if the sourcefile has the correct format, utf-8 here (else throws 

MalformedInputException) 

AND syntax is corrected to: 

try ( BufferedReader br = Files.newBufferedReader(Paths.get(source), 

Charset.forName(“UTF-8)); 

BufferedWriter bw = Files.newBufferedWriter(Paths.get(dest), Charset.forName(“UTF-8)); 

){ 

String record = “”; 

…..