The Oracle specialists have the potential being a specialist in IT area should also attain the maximum associated with capability as well as accomplishment, so that they need to be involved in various Oracle certification examinations. Oracle 1Z0-804 named Java SE 7 Programmer II Exam is stepping-stone to inspect the candidates understanding as well as capability inside a relevant area of labor. Exambible Oracle 1Z0-804 on the web practice assessments can guarantee that you can to control individuals very skilled as well as qualified operates. Our 1Z0-804 practice examination provides the genuine questions, ensuring an individual complete the actual 1Z0-804 examination along with best levels.

2016 Jun 1Z0-804 download

Q1. Which class(es) safely protects the doIt () method from concurrent thread access? A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: A,D 

Explanation: 

only A und D possible 

It should be pointed out that: 

public void blah() { 

synchronized (this) { 

// do stuff 

}} 

is semantically equivalent to: 

public synchronized void blah() { 

// do stuff 

Incorrect answer: 

B: A constructor cannot be synchronized. () Object cannot be resolved to a type 

C: in static context (static void main !) no reference to this possible 


Q2. Given the code fragment: 

And a DOS-based file system: 

Which option, containing statement(s), inserted at line 3, creates the file and sets its attributes to hidden andread-only? 

A. DOSFileAttributes attrs = Files.setAttribute(file,"dos:hidden","dos: readonly") Files.createFile(file, attrs) 

B. Files.craeteFile(file); Files.setAttribute(file,"dos:hidden","dos:readonly"); 

C. Files.createFile(file,"dos:hidden","dos:readonly"); 

D. Files.createFile(file); Files.setAttribute(file,"dos:hidden", true); Files.setAttribute(file,"dos:readonly", true); 

Answer: D 

Explanation: 

You can set a DOS attribute using the setAttribute(Path, String, Object, LinkOption...) 

method, as 

follows: 

Path file = ...; 

Files.setAttribute(file, "dos:hidden", true); 

Note: 

setAttribute 

public static Path setAttribute(Path path, 

String attribute, 

Object value, 

LinkOption... options) 

throws IOException 

Sets the value of a file attribute. 

Reference:Interface DosFileAttribute 


Q3. Give: 

What is the result? 

A. There are 27 sports cars and 5 trucks 

B. There are 27 convertibles and 5 trucks 

C. There are 9 sports cars and 5 trucks 

D. There are 9 convertibles and 5 trucks 

E. IllegalFormatConversionException is thrown at runtime 

Answer: C 

Explanation: 

Strings are immutable, therefore no change at line: svar.replace(svar,"convertibles"); 

Format String Syntax: 

%[argument_index$][flags][width][.precision]conversion 

The optional argument_index is a decimal integer indicating the position of the argument in 

the argument list. 

The first argument is referenced by "1$", the second by "2$", etc. 

The optional flags is a set of characters that modify the output format. The set of valid flags 

depends on theconversion. 

's', 'S' general 

'd' integral The result is formatted as a decimal / integer 


Q4. Which three are true? 

A. A setAutoCommit (False) method invocation starts a transaction context. 

B. An instance of Savepoint represents a point in the current transaction context. 

C. A rollback () method invocation rolls a transaction back to the last savepoint. 

D. A rollback () method invocation releases any database locks currently held by this connection object. 

E. After calling rollback (mysavepoint), you must close the savepoint object by calling mySavepoint.close() . 

Answer: A,B,C 

Explanation: 

A:The way to allow two or more statements to be grouped into a transaction is to disable the auto-commitmode. After the auto-commit mode is disabled, no SQL statements are committed until you call the methodcommit explicitly. All statements executed after the previous call to the method commit are included in thecurrent transaction and committed together as a unit. Note:When a connection is created, it is in auto-commit mode. This means that each individual SQL statementis treated as a transaction and is automatically committed right after it is executed. (To be more precise, thedefault is for a SQL statement to be committed when it is completed, not when it is executed. A statement iscompleted when all of its result sets and update counts have been retrieved. In almost all cases, however, astatement is completed, and therefore committed, right after it is executed.) 

B:The method Connection.setSavepoint, sets a Savepoint object within the current transaction. The Connection.rollback method is overloaded to take a Savepoint argument. When a transaction is rolled back toa savepoint all changes made after that savepoint are undone. 

C: calling the method rollback terminates a transaction and returns any values that were modified to theirprevious values. If you are trying to execute one or more statements in a transaction and get a SQLException, call the method rollback to end the transaction and start the transaction all over again. 


Q5. Given the code fragment: 

What change should you make to apply good coding practices to this fragment? 

A. Add nested try-with-resources statements for the statement and ResultSet declarations. 

B. Add the statement and ResultSet declarations to the try-with-resources statement. 

C. Add a finally clause after the catch clause. 

D. Rethrow SQLException. 

Answer: C 

Explanation: 

The finally block always executes when the try block exits. This ensures that the finally block is executed evenif an unexpected exception occurs. But finally is useful for more than just exception handling -- it allows theprogrammer to avoid having cleanup code accidentally bypassed by a return, continue, or break.Putting cleanup code in a finally block is always a good practice, even when no exceptions areanticipated. 


certifyforall.com

Avant-garde kaplan 1z0-804:

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


Q7. Which four are true about enums? 

A. An enum is typesafe. 

B. An enum cannot have public methods or fields. 

C. An enum can declare a private constructor. 

D. All enums implicitly implement Comparable. 

E. An enum can subclass another enum. 

F. An enum can implement an interface. 

Answer: A,C,D,F Explanation: 

C: The constructor for an enum type must be package-private or private access. Reference: Java Tutorials,Enum Types 


Q8. Given a language code of fr and a country code of FR, which file name represents a resource bundle file namethat is not the default? 

A. MessageBundle_fr_FR.properties 

B. MessageBundle_fr_FR.profile 

C. MessageBundle_fr_FR.xinl 

D. MessageBundle__fr__FR.Java 

E. MessageBundle__fr__FR.Locale 

Answer: A 

Explanation: 

The default file is MessageBundle.properties. The non-default file name is 

MessageBundle_fr_FR.properties 

Note 0:.properties is a file extension for files mainly used in Java related technologies to 

store the configurableparameters of an application. They can also be used for storing 

strings for Internationalization and localization;these are known as Property Resource 

Bundles. Each parameter is stored as a pair of strings, one storing thename of the 

parameter (called the key), and the other storing the value.Note 1:You can obtain an 

instance of ResourceBundle by calling its static getBundle method.public static 

ResourceBundle getBundle(java.lang.String baseName) public static ResourceBundle 

getBundle(java.lang.String baseName, Locale locale) For example: 

ResourceBundle rb = ResourceBundle.getBundle("MyResources", Locale.US); This will 

load theResourceBundle object with the values in the corresponding properties file.1.If a 

suitable properties file is not found, the ResourceBundle object will use the default 

properties file, whichwill be the one whose name equals the base name and has the 

properties extension. In this case, the defaultfile would be MyResources.properties. 2.If this 

file is not found, a java.util.MissingResourceException will bethrown. 

Note2:java.util.ResourceBundle class enables you to choose and read the properties file 

specific to the user'slocale and look up the values. 

A ResourceBundle object has a base name. In order for a ResourceBundle object to pick 

up a properties file,the filename must be composed of the ResourceBundle base name, 

followed by an underscore, followed bythe language code, and optionally followed by 

another underscore and the country code. 

The format for the properties file name is as follows: 

basename_languageCode_countryCode 

For example, suppose the base name is MyResources and you define the following three 

locales: 

US-en DE-de CN-zh Then you would have these three properties files: MyResources_en_US.properties MyResources_de_DE.properties MyResources_zh_CN.properties 

Reference:Reading Properties Files using ResourceBundle 


Q9. Given the code format: 

SimpleDateFormat sdf; 

Which code statements will display the full text month name? 

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

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

C. sdf = new SimpleDateFormat ("MMM", Locale.UK); System.out.println("Result:", sdf.format(new date())); 

D. sdf = new SimpleDateFormat ("MMMM", Locale.UK); System.out.println("Result:", sdf.format(new date())); 

Answer: D 

Explanation: 

Typical output would be Current Month in M format: 2 Current Month in MM format: 02 Current Month in MMM format: Feb Current Month in MMMM format: February 


Q10. Given: What is the result? 

A. doc 

B. index.html 

C. an IllegalArgumentException is thrown at runtime. 

D. An InvalidPthException is thrown at runtime. 

E. Compilation fails. 

Answer: B 

Explanation: 

p.getName(int location) = returns path' name element by index/location (starts with 0) 

Example: 

path = "project//doc//index.html" 

p.getName(0) = project 

p.getName(1) = doc 

p.getName(2) = index.html