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

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: 21


Ensurepass 2018 PDF and VCE

Which three statements concerning the OO concepts quot;is-aquot; and quot;has-aquot; are true?

  1. Flimmer is-a Plinkable

  2. Flommer has-a Tagget

  3. Flommer is-a Glommer

  4. Tagget has-a String

  5. Flommer is-a Plinkable

  6. Flimmer is-a Flommer

  7. Tagget is-a Plinkable

Answer: A,B,E Explanation:

A: Flimmer implements Plinkable. Flimmer is-a plinkable.

D:The relationship modeled by composition is often referred to as the quot;has-aquot; relationship. HereTaggethasaString.

F: Flommer extends Flimmer

So there is an quot;is-a relationship between Flommer and Flimmer .

Note: Thehas-a relationship has anencapsulation feature (like private or protected modifier used before eachmember field or method).

Question No: 22

Which two compile?

  1. interface Compilable { void compile();


  2. interface Compilable { final void compile();


  3. interface Compilable { static void compile();


  4. interface Compilable { abstract void compile();


  5. interface Compilable { protected abstract void compile ();


Answer: A,D

Question No: 23

Which is a key aspect of composition?

  1. Using inheritance

  2. Method delegation

  3. Creating abstract classes

  4. Implementing the composite interface

Answer: B Explanation:

In the composition approach, the subclass becomes the quot;front-end class,quot; and the superclass becomes thequot;back-end class.quot; With inheritance, a subclass automatically inherits an implemenation of any non-privatesuperclass method that it doesn#39;t override. With composition, by contrast, the front-end class must explicitlyinvoke a corresponding method in the back-end class from its own implementation of the method. This explicitcall is

sometimes called quot;forwardingquot; or quot;delegatingquot; the method invocation to the back-end object.Note: Composition means the same as:

  • contains

  • is part of

Note 2: As you progress in an object-oriented design, you will likely encounter objects in the problem domainthat contain other objects. In this situation you will be drawn to modeling a similar arrangement in the design ofyour solution. In an object-oriented design of a Java program, the way in which you model objects that containother objects is with composition, the act of composing a class out of references to other objects.

Withcomposition, references to the constituent objects become fields of the containing object. To use compositionin Java, you use instance variables of one object to hold references to other objects.

Question No: 24


Ensurepass 2018 PDF and VCE

What two changes should you make to apply the DAO pattern to this class?

  1. Make the Customer class abstract.

  2. Make the customer class an interface.

  3. Move the add, delete, find, and update methods into their own implementation class.

  4. Create an interface that defines the signatures of the add, delete, find, and update methods.

  5. Make the add, delete, and find, and update methods private for encapsulation.

  6. Make the getName and getID methods private for encapsulation.

Answer: C,D Explanation:

C:The methods related directly to the entity Customer is moved to a new class. D: 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; } 102

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; } Note: DAO Design Pattern

*Abstracts and encapsulates all access to a data source *Manages the connection to the data source to obtainand store data *Makes the code independent of the data sources and data vendors (e.g. plain-text, xml, LDAP,

MySQL, Oracle, DB2)

Ensurepass 2018 PDF and VCE

D:\Documents and Settings\useralbo\Desktop\1.jpg

Question No: 25

Which two are true about Singletons?

  1. A Singleton must implement serializable.

  2. A Singleton has only the default constructor.

  3. A Singleton implements a factory method.

  4. A Singleton improves a class#39;s cohesion.

  5. Singletons can be designed to be thread-safe.

Answer: C,E

Question No: 26

What are two differences between Callable and Runnable?

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

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

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

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

Answer: A,D 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 No: 27

Which two properly implement a Singleton pattern?

  1. class Singleton {

    private static Singleton instance; private Singleton () {}

    public static synchronized Singleton getInstance() { if (instance == null) {

    instance = new Singleton ();


    return instance;



  2. class Singleton {

    private static Singleton instance = new Singleton(); protected Singleton () {}

    public static Singleton getInstance () { return instance;



  3. class Singleton { Singleton () {}

    private static class SingletonHolder {

    private static final Singleton INSTANCE = new Singleton ();


    public static Singleton getInstance () { return SingletonHolder.INSTANCE;



  4. enum Singleton { INSTANCE;


Answer: A,D Explanation:

A: Here the method for getting the reference to the SingleTon object is correct. B: The constructor should be private

C: The constructor should be private

Note: Java has several design patterns Singleton Pattern being the most commonly used. Java Singletonpattern belongs to the family of design patterns, that govern the instantiation process. This design patternproposes that at any time there can only be one instance of a singleton (object) created by the JVM.

The class#39;s default constructor is made private, which prevents the direct instantiation of the object by others(Other Classes). A static modifier is applied to the instance method that returns the object as it then makes thismethod a class level method that can be accessed without creating an object.



OPTION D == Serialzation and thraead-safety guaranteed and with couple of line of code enum Singletonpattern is best way to create Singleton in Java 5 world.


2gt;gt;CLASS LOADING (initialization) USINGprivate static final Singleton instance = new Singleton();





Question No: 28


Ensurepass 2018 PDF and VCE

Which two statements concerning the OO concepts quot;IS-Aquot; and quot;HAS-Aquot; are true?

  1. Flimmer is-a Glommer.

  2. Flommer has-a String.

  3. Tagget has-a Glommer.

  4. Flimmer is-a ArrayList.

  5. Tagget has-a doStuff()

  6. Tagget is-a Glommer.

Answer: B,F Explanation:

B: The relationship modeled by composition is often referred to as the quot;has-aquot; relationship. Here Flommer hasaString.

E: The has-a relationship has an encapsulation feature (like private or protected modifier used before eachmember field or method).

Here Tagget has-a method doStuff() F: Tagget implements Glommer.

Tagget is-a Glommer.

Note: The has-a relationship has an encapsulation feature (like private or protected modifier used before eachmember field or method).

Question No: 29

Given the integer implements comparable:

Ensurepass 2018 PDF and VCE

What is the result?

  1. 4 1

  2. 1 2

  3. 32

  4. 21

  5. 2 3

Answer: D Explanation: binarySearch

public static lt;Tgt; int binarySearch(Listlt;? extends Comparablelt;? super Tgt;gt; list, T key) Searches the specified list for the specified object using the binary search algorithm.

The list must be sorted into ascending order according to the natural ordering of its elements (as by the sort(List) method) prior to making this call. If it is not sorted, the results are undefined.


list – the list to be searched.

key – the key to be searched for. Returns:

the index of the search key, if it is contained in the list; otherwise, (-(insertion point) – 1).

Question No: 30

Which statement declares a generic class?

  1. public class Example lt; T gt; { }

  2. public class lt;Examplegt; { }

  3. public class Example lt;gt; { }

  4. public class Example (Generic) { }

  5. public class Example (G) { }

  6. public class Example { }

Answer: A Explanation: Example:

public class Pocketlt;Tgt;


private T value; public Pocket() {}

public Pocket( T value ) { this.value = value; } public void set( T value ) { this.value = value; } public T get() { return value; }

public boolean isEmpty() { return value != null; } public void empty() { value = null; }


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.