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

Ensurepass

QUESTION 61

Given:

 

clip_image002

 

What is the result?

 

A.

5

B.

6

C.

An exception is thrown at runtime

D.

Compilation fails due to an error on line 6

E.

Compilation fails due to an error on line 7

 

Correct Answer: C

Explanation:

The code compile fine but java.lang.NullPointerException is thrown at runtime. x has no value. The code would run if line 2 was changed to: Integer x = 3;

 

 

 

 

 

 

 

QUESTION 62

Given:

 

ConcurrentMap <String, String> PartList = new ConcurrentMap<>();

 

Which fragment puts a key/value pair in partList without the responsibility of overwriting an existing key?

 

A.


partList.out(key,”Blue Shirt”);

B.

partList.putIfAbsent(key,”Blue Shirt”);

C.

partList.putIfNotLocked (key,”Blue Shirt”);

D.

partList.putAtomic(key,”Blue Shirt”)

E.

if (!partList.containsKey(key)) partList.put (key,”Blue Shirt”);

 

Correct Answer: B

Explanation:

putIfAbsent(K key, V value)

If the specified key is not already associated with a value, associate it with the given value.

Reference: java.util.concurrent,Interface ConcurrentMap<K,V>

 

 

QUESTION 63

Given the code fragment:

 

DateFormat df;

 

Which statement defines a new Dateformat object that displays the default date format for the UK Locale?

 

A.

df = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale (UK));

B.

df = DateFormat.getDateInstance (DateFormat.DEFAULT, UK);

C.

df = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.UK);

D.

df = new DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.UK);

E.

df = new DateFormat.getDateInstance (DateFormat.DEFAULT, Locale (UK)
);

 

Correct Answer: C

Explanation:

The UK locale is constructed withLocale.UK.

To format a date for a different Locale, specify it in the call to getDateInstance().

DateFormat df =

DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);

Note: getDateInstance( int style, Locale aLocale )

Gets the date formatter with the given formatting style for the given locale.

Reference: Class DateFormat

 

 

 

 

 

 

 

 

 

 

 

QUESTION 64

Given:

 

clip_image004

 

What is the result?

 

A.

Both const and inner will be in the output.

B.

Only const will be in the output.

C.

Compilation fails due to an error on line A.

D.

Compilation fails due to an error on line B.

E.

An Exception is thrown at runtime.

 

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

Reference: java.lang

Interface Runnable

QUESTION 65

Which two statements are true about RowSet subinterfaces?

 

A.

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

B.

A CachedRowSet provides a connected view of the database.

C.

A FilteredRowSet object filter can be modified at any time.

D.

A WebRowSet returns JSON-formatted data.

 

Correct Answer: AC

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 66

Given:

 

clip_image006

 

What is the result?

 

A.

Event Quiz

B.

Event Event

C.

Quiz Quiz

D.

Quiz Event

E.

Compilation fails

 

Correct Answer: E

 

 

QUESTION 67

Given:

 

clip_image008

 

Which three statements concerning the OO concepts “is-a” and “has-a” are true?

 

A.

Flimmer is-a Plinkable

B.

Flommer has-a Tagget

C.

Flommer is-a Glommer

D.

Tagget has-a String

E.

Flommer is-a Plinkable

F.

Flimmer is-a Flommer

G.

Tagget is-a Plinkable

 

Correct Answer: ABE

Explanation:

A: Flimmer implements Plinkable.

Flimmer is-a plinkable.

D: The relationship modeled by composition is often referred to as the “has-a” relationship.

HereTaggethasaString.

F: Flommer extends Flimmer

So there is an “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 68

Which two demonstrate the valid usage of the keyword synchronized?

 

A.

interface ThreadSafe {

synchronized void doIt();

}

B.

abstract class ThreadSafe {

synchronized abstract void doIt();

}

C.

class ThreadSafe {

synchronized static void soIt () {}

}

D.

enum ThreadSafe {

ONE, TWO, Three;

synchronized final void doIt () {}

}

 

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

Which four are true about enums?

 

A.

An enum is typesafe.

B.

An enum cannot have public methods or fields.

C.

An enum can declare a private constructor.

D.

All enums implicitly implement Comparable.

E.

An enum can subclass another enum.

F.

An enum can implement an interface.

 

Correct Answer: ACDF

Explanation:

C: The constructor for an enum type must be package-private or private access.

Reference: Java Tutorials,Enum Types

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

QUESTION 70

Given:

 

clip_image010

 

What is the result?

 

A.

false

salesqu
arter . . qtrlreport.txt

B.

false

quarter . . qtrlreport.txt

C.

true

. . . . . . annualreport.txt

D.

true

. . . . annualreport.txt

 

Correct Answer: A

Explanation:

( richtig !! import java.nio.file.Path; import java.nio.file.Paths; ) original-Aufgabe war ( falsch >>

import java.io.file.Path; import java.io.file.Paths; ) The relativize method that can be used to construct a relative path between two paths.

relativize

Path relativize(Path other)

Constructs a relative path between this path and a given path. Parameters:other – the path to relativize against this path Returns:the resulting relative path, or an empty path if both paths are equal Note:

Relativization is the inverse of resolution. This method attempts to construct a relative path that when resolvedagainst this path, yields a path that locates the same fil
e as the given path. For18example, on UNIX, if this path is “/a/b” and the given path is “/a/b/c/d” then the resulting relative path would be”c/d”. Where this path and the given path do not have a root component, then a relative path can beconstructed. A relative path cannot be constructed if only one of the paths have a root component. Where bothpaths have a root component then it is implementation dependent if a relative path can be constructed. If thispath and the given path are equal then an empty path is returned. For any two normalized paths p and q, where q does not have a root component,p.relativize(p.resolve(q)).equals(q)

When symbolic links are supported, then whether the resulting path, when resolved against this path, yields apath that can be used to locate the same file as other is implementation dependent. For example, if this path is”/a/b” and the given path is “/a/x” then the resulting relative path may be “../x”. If “b” is a symbolic link then isimplementation dependent if “a/b/../x” would locate the same file as “/a/x”.

 

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.