[Free] 2018(Jan) EnsurePass Examcollection Oracle 1z0-804 Dumps with VCE and PDF 61-70

2018 Jan Oracle Official New Released 1z0-804
100% Free Download! 100% Pass Guaranteed!

Java SE 7 Programmer II

Question No: 61

Given the following code fragment:

  1. p1 = paths.get(quot;report.txtquot;);

  2. p2 = paths.get(quot;companyquot;);

  3. / / insert code here

Which code fragment, when inserted independently at line 12, move the report.txt file to the company directory,at the same level, replacing the file if it already exists?

  1. Files.move(p1, p2, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);

  2. Files.move(p1, p2, StandardCopyOption.REPLACE_Existing, LinkOption.NOFOLLOW_LINKS);

  3. Files.move(p1, p2, StandardCopyOption.REPLACE_EXISTING, LinkOption.NOFOLLOW_LINKS);

  4. Files.move(p1, p2, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.copy_ATTRIBUTES,


  5. Files.move (p1, p2, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.copy_ATTRIBUTES,


Answer: A,C Explanation:

Moving a file is equally as straight forward

move(Path source, Path target, CopyOption… options); The available StandardCopyOptions enums available are: StandardCopyOption.REPLACE_EXISTING StandardCopyOption.ATOMIC_MOVE

If Files.move is called with StandardCopyOption.COPY_ATTRIBUTES an UnsupportedOperationException isthrown.

Question No: 62

Given the code fragment:

Ensurepass 2018 PDF and VCE

What is the result when the result.txt file already exists in c:\student?

  1. The program replaces the file contents and the file#39;s attributes and prints Equal.

  2. The program replaces the file contents as well as the file attributes and prints Not equal.

  3. An UnsupportedOperationException is thrown at runtime.

  4. The program replaces only the file attributes and prints Not equal.

Answer: B Explanation:

Assuming there is a file D:\\faculty\\report.txt then this file will be copied and will be

replacing C:\\student\\report.txt.

Question No: 63

An application is waiting for notification of changes to a tmp directory using the following code statements:

Path dir = Paths.get(quot;tmpquot;)

WatchKey key = dir.register (watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY) ;

In the tmp directory, the user renames the file testA to testB, Which statement is true?

  1. The events received and the order of events are consistent across all platforms.

  2. The events received and the order of events are consistent across all Microsoft Windows versions.

  3. The events received and the order of events are consistent across all UNIX platforms.

  4. The events received and the order of events are platform dependent.

Answer: A Explanation:

Most file system implementations have native support for file change notification. The WatchService API takesadvantage of this support where available.

However, when a file system does not support this mechanism, the WatchService will poll the file system,waiting for events.


WatchKey : When a Watchable entity is registered with a WatchService a key which is a WatchKey isgenerated. Initially the key is in ready state waiting to be notified of any events on the Watchable entity. Oncean event occurs the key goes into signaled state and allows to access the events using its pollEvents method.

After processing the poll events the key has to be reset by invoking its reset method. Reference: The Java Tutorials,Watching a Directory for Changes

Question No: 64


Ensurepass 2018 PDF and VCE

What is the result?

  1. doc

  2. index.html

  3. an IllegalArgumentException is thrown at runtime.

  4. An InvalidPthException is thrown at runtime.

  5. Compilation fails.

Answer: B Explanation:

p.getName(int location) = returns path#39; name element by index/location (starts with 0) Example:

path = quot;project//doc//index.htmlquot; p.getName(0) = project p.getName(1) = doc

p.getName(2) = index.html

Question No: 65

Given the code fragment:

Ensurepass 2018 PDF and VCE

What is the result?

  1. getName (0): C:\

    subpath (0, 2): C:\education\report.txt

  2. getName(0): C:\ subpth(0, 2): C:\education

  3. getName(0): education subpath (0, 2): education\institute

  4. getName(0): education

    subpath(0, 2): education\institute\student

  5. getName(0): report.txt subpath(0, 2): insritute\student

Answer: C Explanation: Example:

Path path = Paths.get(quot;C:\\home\\joe\\fooquot;); getName(0)

-gt; home subpath(0,2)

Reference: The Java Tutorial, Path Operations

Question No: 66

ITEM Table





And given the code fragment (assuming that the SQL query is valid):

Ensurepass 2018 PDF and VCE

What is the result of compiling and executing this code?

  1. An exception is thrown at runtime

  2. Compile fails

  3. The code prints Error

  4. The code prints information about Item 110

Answer: C Explanation: Tricky:

Compiles successfully ! Not B !

D is correct, if Column Quantity instead of Quality

Table Item Column Quality — System.out.println(quot;Quantity: quot; rs.getInt(quot;Quantityquot;)); wenn jedoch so gewollt: die Zeile gibt Error aus (die anderen funktionieren) !!!

The connection conn is not defined. The code will not compile.

Question No: 67

Which code fragment demonstrates the proper way to handle JDBC resources?

  1. try {

    ResultSet rs = stmt.executeQuery (query); statement stmt = con.createStatement(); while (rs.next()) (/* . . . */)

    } catch (SQLException e) {}

  2. try {

    Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery (query); while (rs.next()) (/* . . . */)

    } catch (SQLException e) {}

  3. try {

    Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery (query); while (rs.next()) (/* . . . */)

    } finally { rs.close();



  4. try {

ResultSet rs = stmt.executeQuery (query); Statement stmt = con.createStatement(); while (rs.next()) (/* . . . */)

} finally { rs.close();



Answer: C

Question No: 68

Given the code fragment:

Ensurepass 2018 PDF and VCE

What is the result of the employees table has no records before the code executed?

  1. 1 Sam

  2. 4 Jack

  3. 3 John 4 Jack

  4. 1 Sam 3 John

4 Jack

Answer: C Explanation:

AutoCommit is set to false. The two following statements will be within the same transaction.

stmt.executeUpdate(quot;insert into employees values(1,#39;Sam#39;)quot;); stmt.executeUpdate(quot;insert into employees values(2,#39;Jane#39;)quot;);

These two statements are rolled-back through (the savepoint is ignored! the savepoint must be specified (e.g.

conn.rollback(save1); ) in the rollback if you want to rollback to the savepoint): conn.rollback() ;

The next two insert statements are executed fine. Their result will be in the output.

Question No: 69

Given the code fragment:

Ensurepass 2018 PDF and VCE

Assume that the SQL queries return records. What is the result of compiling and executing this code fragment?

  1. The program prints employee IDs

  2. The program prints customer IDs

  3. The program prints Error

  4. Compilation fails on line ***

Answer: C Explanation:

!!! The given Code prints Error – the second query clears the ResultSet !? ErrorMessage: Operation notallowed after ResultSet closed

It would print A, if second Query i set to rs = stmt.executeQuery(quot;SELECT ID FROM Customerquot;); // Line ***

It would print B, if Line *** is missing. //

The program compiles and runs fine. Both executeQuery statements will run. The first executeQuery statement

(ResultSet rs = stmt.executeQuery(query);) will set the rs Resultset. It will be used in the while loop. EmployIDswill be printed.


Executes the given SQL statement, which returns a single ResultSet object. Parameters:sql – an SQL statement to be sent to the database, typically a static SQL SELECT statement Returns:a ResultSet object that contains the data produced by the given query; never null

Question No: 70

Which two actions can be used in registering a JDBC 3.0 driver?

  1. Add the driver class to the META-INF/services folder of the JAR file.

  2. Set the driver class name by using the jdbc.drivers system property.

  3. Include the JDBC driver class in a jdbcproperties file.

  4. Use the java.lang.class.forName method to load the driver class.

  5. Use the DriverManager.getDriver method to load the driver class.

Answer: A,D Explanation:

A: if your JDBC Driver is NOT JDBC 4-compliant then we can update the driver using quot;jarquot;- utility by adding the

quot;META-INF /services/java.sql.Driverquot; inside it. as following:

D:Dynamic loading of Java classes at runtime provides tremendous flexibility in the development of enterprisesystems. It provides for the basis of quot;application serversquot;, and allows even simpler, lighter-weight systems toaccomplish some of the same ends. Within Java, dynamic-loading is typically achieved by calling the forNamemethod on the class java.lang.ClassAn example provided by the standard Java SE API is the ServiceLoader. Amongothers, the JDBC 4.0compatible drivers implement this. This way just dropping the JDBC driver JAR file folder will automatically loadthe driver class during Java application#39;s startup/initialization without the need for any manual Class.forName(quot;com.example.Driverquot;) line in your code.

100% Free Download!
Download Free Demo:1z0-804 Demo PDF
100% Pass Guaranteed!
Download 2018 EnsurePass 1z0-804 Full Exam PDF and VCE

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

2018 EnsurePass IT Certification PDF and VCE

Leave a Comment


Your email address will not be published. Required fields are marked *