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

Ensurepass

QUESTION 51

Given the incomplete pseudo-code for a fork/join framework application:

 

clip_image002

 

And given the missing methods:

 

Process, submit, and splitInHalf

 

Which three insertions properly complete the pseudo-code?

 

A.

Insert submit at line X.

B.

Insert splitInHalf at line X.

C.

Insert process at line X.

D.

Insert process at line Y.

E.

Insert splitInHalf at line Y.

F.

Insert process at line Z.

G.

Insert submit at line Z.

 

Correct Answer: CEG

Explanation:

C: If data is small enough then process it. Line X

E: If data is not small enough then split it half. Line Y

G: After the data has been split (line Y) then recursively submit the splitted data (Line z).

 

QUESTION 52

Given:

 

clip_image004

 

What is the result?

 

A.

Daniel

B.

Unknown

C.

It may print”unknown”or”Daniel”depending on the JVM implementation.

D.

Compilation fails.

E.

An exception is thrown at runtime.

 

Correct Answer: D

Explanation:

The compilation fails at line start();

Erstellen eines statischen Verweises auf die nicht statische Methode start() vom Typ

Uncompilable source code – non-static method start()cannot be referenced from a static context

 

 

QUESTION 53

Given:

 

clip_image006

 

What is the result?

 

A.

Up Down

B.

Up Up

C.

Up null

D.

Compilation fails

E.

An exception is thrown at runtime

 

Correct Answer: D

Explanation:

Exception in thread “main” java.lang.ExceptionInInitializerError at garden.Garden.main Caused by: java.lang.RuntimeException: Uncompilable source code – garden.Plant is not abstract and doesnot override abstract method growthDirection() in garden.Plant

 

 

QUESTION 54

Given:

 

clip_image008

 

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

 

Correct Answer: BCE

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.

 

 

QUESTION 55

Given:

 

clip_image010

 

What is the result?

 

A.

Pastel

Enamel

Fresco

Gouache

B.

Pastel

*Enamel

Fresco

*Gouache

C.

Pastel

Enamel

Fresco

Gouache

D.

Pastel

Enamel, Fresco

Gouache

 

Correct Answer: B

Explanation:

regex explanation:

, = ,

= masks the following

s = A whitespace character: [ t n x0B f r ]

* = Greedy Quantifier: zero or more times

Delimiter: comma + zero or more whitespace characters

 

 

QUESTION 56

Given:

 

String s = new String(“3”);

 

System.out.print(1 + 2 + s + 4 + 5);

 

What is the result?

 

A.

12345

B.

3345

C.

1239

D.

339

E.

Compilation fails.

 

Correct Answer: B

Explanation:

1 and 2 are added.

Then the string s is concatenated.

Finally 3 and 4 are concatenated as strings.

 

 

QUESTION 57

Given:

 

clip_image011

 

Which group of method is moved to a new class when implementing the DAO pattern?

 

A.

public in getId ()

public String getContractDetails ()

public Void setContractDetails(String contactDetails)

public String getName ()

public void setName (String name)

B.

public int getId ()

public String getContractDetails()

public String getName()

public Person getPerson(int id) throws Exception

C.

public void setContractDetails(String contractDetails)

public void setName(String name)

D.

public Person getPerson(int id) throws Exception

public void createPerson(Person p) throws Exception

public void deletePerson(int id) throws Exception

public void updatePerson(Person p) throws Exception

 

Correct Answer: D

Explanation:

The methods related directly to the entity Person is moved to a new class.

CRUD

Note:DAO Design Pattern

*Abstracts and encapsulates all access to a data source

*Manages the connection to the data source to obtain and store data

*Makes the code independent of the data sources and data vendors (e.g. plain-text, xml, LDAP, MySQL, Oracle, DB2)

 

clip_image013

 

Example (here Customer is the main entity):

public class Customer {

private final String id;

private String contactName;

private String phone;

public void setId(String id) { this.id = id; }

public String getId() { return this.id; }

public void setContactName(String cn) { this.contactName = cn;}

public String getContactName() { return

this.contactName; }

public void setPhone(String phone) { this.phone = phone; }

public String getPhone()

{ return this.phone; }

}

public interface CustomerDAO {

public void addCustomer(Customer c) throws DataAccessException;

public Customer getCustomer(String id)

throws DataAccessException;

public List getCustomers() throws DataAccessException;

public void

removeCustomer(String id) throws DataAccessException;

public void modifyCustomer(Customer c) throws

DataAccessException; }

 

 

 

 

 

 

 

 

 

 

 

 

QUESTION 58

Given:

 

clip_image015

 

What is the result?

 

A.

Compilation succeeds.

B.

Compilation fails due to an error on line 1.

C.

Compilation fails due to an error on line 2.

D.

Compilation fails due to an error on line 3.

E.

Compilation fails due to an error on line 4.

F.

Compilation fails due to an error on line 8.

 

Correct Answer: A

 

 

QUESTION 59

Given:

 

clip_image017

What is the result?

 

A.

1 1 1 1 1

B.

1 2 3 4 5

C.

0 1 2 3 4

D.

0 1 4 3 4

 

Correct Answer: A

Explanation:

first for-loop

set 0 0 0 0 0

second for-loop increments each

to 1 1 1 1 1

if condition is not given

 

 

QUESTION 60

Given:

 

clip_image019

 

From what threading problem does the program suffer?

A.

deadlock

B.

livelock

C.

starvation

D.

race condition

 

Correct Answer: B

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.

 

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.