[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-804 Dumps with VCE and PDF 71-80

By | January 25, 2018

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-804
100% Free Download! 100% Pass Guaranteed!

Java SE 7 Programmer II

Question No: 71

Given the code fragment:

Ensurepass 2018 PDF and VCE

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

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

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

  3. Add a finally clause after the catch clause.

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

Question No: 72

Which two statements are true about RowSet subinterfaces?

  1. A JdbcRowSet object provides a JavaBean view of a result set.

  2. A CachedRowSet provides a connected view of the database.

  3. A FilteredRowSet object filter can be modified at any time.

  4. A WebRowSet returns JSON-formatted data.

Answer: A,C Explanation:

A: a JdbcRowSet object can be one of the Beans that a tool makes available for composing an application.

Because a JdbcRowSet is a connected RowSet, that is, it continually maintains its connection to a databaseusing a JDBC technology-enabled driver, it also effectively makes the driver a JavaBeans component.

C: The FilteredRowSet range criterion can be modified by applying a new Predicate object to the

FilteredRowSet instance at any time. This is possible if no additional references to the FilteredRowSet objectare detected. A new filter has an immediate effect on criterion enforcement within the FilteredRowSet object,and all subsequent views and updates will be subject to similar enforcement.

Reference: javax.sql Interface RowSet

Question No: 73

Which code fragment is required to load a JDBC 3.0 driver?

  1. DriverManager.loadDriver (quot;org.xyzdata.jdbc.NetworkDriverquot;);

  2. Class.forName(quot;org.xyzdata.jdbc-NetworkDriverquot;);

  3. Connection con = Connection.getDriver (quot;jdbc:xyzdata://localhost:3306/EmployeeDBquot;);

  4. Connection con = DriverManager.getConnection (quot;jdbc:xyzdata://localhost:3306/EmployeeDBquot;);

Answer: B Explanation:

In previous versions (prior to 4.0) of JDBC, to obtain a connection, you first had to initialize your JDBCdriver by calling the method Class.forName. This methods required an object of type java.sql.Driver.


DriverManager: This fully implemented class connects an application to a data source, which is specified by adatabase URL. When this class first attempts to establish a connection, it automatically loads any JDBC 4.0drivers found within the class path. Note that your application must manually load any JDBC drivers prior toversion 4.0.

Question No: 74

Which three are true?

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

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

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

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

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

Question No: 75

Given the code fragment:

Ensurepass 2018 PDF and VCE

Assume that the SQL query matches one record. What is the result of compiling and executing this code?

  1. The code prints Error.

  2. The code prints the employee ID.

  3. Compilation fails due to an error at line 13.

  4. Compilation fails due to an error at line 14.

Answer: A Explanation:

The code compiles fine.

A: prints Error: rs.next() fehlt !! Fehlermeldung: Before start of result set mit rs.next() Aufruf : The code would run fine.

public int getInt(String columnName) throws SQLException

Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Javaprogramming language

Question No: 76


Ensurepass 2018 PDF and VCE

Which two are true?

  1. A runtime exception is thrown on line 9.

  2. No output is produced.

  3. Greeting is printed once.

  4. Greeting is printed twice.

  5. No new threads of execution are started within the main method.

  6. One new thread of execution is started within the main method.

  7. Two new threads of execution are started within the main method.

Answer: C,E Explanation:

Thread t2 is executed. Execution of T2 starts executionen of t1. Greeting is printed during theexecution of t1.

Question No: 77

Which two demonstrate the valid usage of the keyword synchronized?

  1. interface ThreadSafe { synchronized void doIt();


  2. abstract class ThreadSafe { synchronized abstract void doIt();


  3. class ThreadSafe { synchronized static void soIt () {}


  4. enum ThreadSafe { ONE, TWO, Three;

synchronized final void doIt () {}


Answer: C Explanation:

The Java programming language provides two basic synchronization idioms: synchronized methods and synchronized statements.

To make a method synchronized, simply add the synchronized keyword to its declaration.

Question No: 78


Ensurepass 2018 PDF and VCE

What is the result?

  1. Both const and inner will be in the output.

  2. Only const will be in the output.

  3. Compilation fails due to an error on line A.

  4. Compilation fails due to an error on line B.

  5. An Exception is thrown at runtime.

Answer: A Explanation:

The code compiles fine.

Note:The Runnable interface should be implemented by any class whose instances are intended to beexecuted by a thread. The class must define a method of no arguments

called run.

This interface is designed to provide a common protocol for objects that wish to execute code while they areactive. For example, Runnable is implemented by class Thread. Being active simply means that a thread hasbeen started and has not yet been stopped.

In addition, Runnable provides the means for a class to be active while not subclassing Thread. Aclass that implements Runnable can run without subclassing Thread by instantiating a Thread instance andpassing itself in as the target. In most cases, the Runnable interface should be used if you are only planning tooverride the run() method and no other Thread methods. This is important because classes should not besubclassed unless the programmer intends on modifying or enhancing the fundamental behavior of the class.

Note 2:start()

Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.


Interface Runnable

Question No: 79

Given the fragment:

Ensurepass 2018 PDF and VCE

If thread a and thread b are running, but not completing, which two could be occurring?

  1. livelock

  2. deadlock

  3. starvation

  4. loose coupling

  5. cohesion

Answer: A,B Explanation:

A: A thread often acts in response to the action of another thread. If the other thread#39;s action is also a responseto the action of another thread, then livelock may result. A thread often acts in response to the action ofanother thread. If the other thread#39;s action is also a response to the action of another thread, then livelock mayresult.

B: Deadlock describes a situation where two or more threads are blocked forever, waiting for each other.

Question No: 80

Which three statements are correct about thread#39;s sleep method?

  1. The sleep (long) method parameter defines a delay in milliseconds.

  2. The sloop (long) method parameter defines a delay in microseconds.

  3. A thread is guaranteed to continue execution after the exact amount of time defined in the sleep (long)parameter.

  4. A thread can continue execution before the amount of time defined in the sleep (long) parameter.

  5. A thread can continue execution after the amount of time defined in the sleep (long) parameter

  6. Only runtime exceptions are thrown by the sleep method.

  7. A thread loses all object monitors (lock flags) when calling the sleep method.

Answer: A,C,E Explanation:

sleep (long millis) not B

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number ofmilliseconds(A, not B)

millis – the length of time to sleep in milliseconds.

throws InterruptedException: – if another thread has interrupted the current thread. The interrupted status ofthe current thread is cleared when this exception is thrown. java.lang.Throwable

java.lang.Exception java.lang.InterruptedException

The thread does not lose ownership of any monitors. It means that if the thread has an object-monitor, all otherthreads that need that monitor are blocked.

This method can be called regardless whether the thread has any monitor or not.

100% Ensurepass Free Download!
Download Free Demo:1z0-804 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-804 Dumps

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.