[Free] Download Latest (March 2016) Oracle 1Z0-804 Real Exam 1-10

Ensurepass

QUESTION 1

Given the cache class:

 

clip_image002

 

A.

101

B.

Compilation fails at line 1.

C.

Compilation fails at line 2.

D.

Compilation fails at line 3.

 

Correct Answer: B

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.

 

 

QUESTION 2

Given:

 

clip_image004

 

What is the result?

 

A.

Three

B.

One

C.

Compilation fails.

D.

The program runs, but prints no output.

 

Correct Answer: A

Explanation:

push

void push(E e)

Pushes an element onto the stack represented by this deque (in other words, at the head of this deque) if it ispossible to do so immediately without violating capacity restrictions, returning true upon success and throwingan IllegalStateException if no space is currently available.

This method is equivalent to addFirst(E).

pop

E pop()

Pops an element from the stack represented by this deque. In other words, removes and returns the firstelement of this deque.

This method is equivalent to removeFirst().

Returns:

the element at the front of this deque (which is the top of the stack represented by this deque)

Throws:

NoSuchElementException – if this deque is empty

 

 

QUESTION 3

Given the code fragment:

 

clip_image006

 

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

 

A.

The code prints Error.

B.

The code prints the employee ID.

C.

Compilation fails due to an error at line 13.

D.

Compilation fails due to an error at line 14.

 

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

Which three statements are correct about thread’s sleep method?

 

A.

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

B.

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

C.

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

D.

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

E.

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

F.

Only runtime exceptions are thrown by the sleep method.

G.

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

 

Correct Answer: ACE

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.

 

 

QUESTION 5

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

 

Correct Answer: D

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

 

 

QUESTION 6

Given:

 

clip_image008

 

Which two are true?

 

A.

A runtime exception is thrown on line 9.

B.

No output is produced.

C.

Greeting is printed once.

D.

Greeting is printed twice.

E.

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

F.

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

G.

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

 

Correct Answer: CE

Explanation:

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

 

 

 

 

 

 

 

 


 

 

 

 

 

 

 

 

 

QUESTION 7

Given the code fragment:

 

clip_image010

 

What is the result?

 

A.

Null B D

B.

Null B null D

C.

B D

D.

D

E.

An exception is thrown at runtime

 

Correct Answer: C

 

 

 

 

 

 

 

 

 

 

QUESTION 8

Given:

 

clip_image012

 

Which three values will appear in the output?

 

A.

5

B.

7

C.

a1

D.

a2

E.

b1

F.

b2

 

Correct Answer: ADE

Explanation:

Staticmethod of base class is invoked >>

A myA = new B();

System.out.print(myA.doA() + myA.doA2() + myA.a);

class B String doA() { return “b1 “; }

class A protected static String doA2 () { return “a2 “; } class B int a = 7;

 

 

QUESTION 9

What are two differences between Callable and Runnable?

 

A.

A Callable can return a value when executing, but a Runnable cannot.

B.

A Callable can be executed by a ExecutorService, but a Runnable cannot.

C.

A Callable can be passed to a Thread, but a Runnable cannot.

D.

A Callable can throw an Exception when executing, but a Runnable cannot.

 

Correct Answer: AD

Explanation:

The Callable interface is similar to Runnable, in that both are designed for classes whose instances arepotentially executed by another thread. A Runnable, however, does not return a result and cannot throw achecked exception.

 

 

QUESTION 10

Which represents part of a DAO design pattern?

 

A.

interface EmployeeDAO {

int getID();

Employee findByID (intid);

void update();

void delete();

}

B.

class EmployeeDAO {

int getID() { return 0;}

Employee findByID (int id) { return null;}

void update () {}

void delete () {}

}

C.

class EmployeeDAO {

void create (Employee e) {}

void update (Employee e) {}

void delete (int id) {}

Employee findByID (int id) {return id}

}

D.

interface EmployeeDAO {

void create (Employee e);

void update (Employee e);

void delete (int id);

Employee findByID (int id);

}

E.

interface EmployeeDAO {

void create (Connection c, Employee e);

void update (Connection c, Employee e);

void delete (Connection c, int id);

Employee findByID (Connection c, int id);

}

 

Correct Answer: D

 

Free VCE & PDF File for Oracle 1Z0-804 Real Exam

Instant Access to Free VCE Files: CompTIA | VMware | SAP …
Instant Access to Free PDF Files: CompTIA | VMware | SAP …

This entry was posted in 1Z0-804 Real Exam (March 2016) and tagged , , , , , , , . Bookmark the permalink.