Free Cheat-test Samples and Demo Questions Download
Adobe exams Adobe
Apple exams Apple
Avaya exams Avaya
Check Point exams Check Point
Cisco exams Cisco
Citrix exams Citrix
CIW exams CIW
CompTIA exams CompTIA
EC-Council exams EC-Council
EMC exams EMC
Exin exams Exin
Fortinet exams Fortinet
Hitachi exams Hitachi
HP exams HP
IBM exams IBM
Isaca exams Isaca
ISC exams ISC
Juniper exams Juniper
LPI exams LPI
McAfee exams McAfee
Microsoft exams Microsoft
Oracle exams Oracle
PMI exams PMI
Riverbed exams Riverbed
SNIA exams SAP
Sun exams SAS
Symantec exams Symantec
VMware exams VMware
All certification exams

Oracle 1Z0-804 Exam -

Free 1Z0-804 Sample Questions:

Q: 1
Given the code fragment:
DataFormat df;
Which statement defines a new Dateformat object that displays the default date format for the UK Locale?
A. df = DateFormat.getdatDataInstance (DateFormat.DEFAULT, Locale (UK));
B. df = DateFormat.getdatDataInstance (DateFormat.DEFAULT, UK);
C. df = DateFormat.getdatDataInstance (DateFormat.DEFAULT, Locale.UK);
D. df = new DateFormat.getdatDataInstance (DateFormat.DEFAULT, Locale.UK);
E. df = new DateFormat.getdatDataInstance (DateFormat.DEFAULT, Locale (UK));
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

Q: 2
public class DoubleThread {
public static void main(String[] args) {
Thread t1 = new Thread() {
public void run() {
Thread t2 = new Thread(t1); // Line 9;
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.
Answer: C,E
Explanation: Thread t2 is executed. Execution of T2 starts executionen of t1. Greeting is printed during the execution of t1.

Q: 3
import java.util.*;
public class AccessTest {
public static void main(String[] args) {
Thread t1 = new Thread(new WorkerThread());
Thread t2 = new Thread(new WorkerThread());
t1.start(); t2.start; // line1
class WorkPool {
static ArrayList<Integer> list = new ArrayList<>(); // line2
public static void addItem() { // line3
list.add(1); // Line4
class WorkerThread implements Runnable {
static Object bar = new Object ();
public void run() { //line5
for (int i=0; i<5000;i++) WorkPool.addItem(); // line6
Which of the four are valid modifications to synchronize access to the valid list between threads t1 and t2?
A. Replace line 1 with:
Synchronized (t2) (t1.start();) synchronized(t1) (t2.start();)
B. Replace Line 2 with:
static CopyWriteArrayList<Integer> list = new CopyWriteArrayList<>();
C. Replace line 3 with:
synchronized public static void addItem () {
D. Replace line 4 with:
synchronized (list) (list.add(1);)
E. Replace line 5 with:
Synchronized public void run () {
F. replace line 6 with:
Synchronized (this) {for (in i = 0, i<5000, i++) WorkPool.addItem(); }
G. Replace line 6 with:
synchronized (bar) {for (int i= 0; i<5000; i++) WorkPool.addItem(); }
Answer: F
Explanation: Away to create synchronized code is with synchronized statements. Unlike synchronized methods, synchronized statements must specify the object that provides the intrinsic lock:
For example:
public void addName(String name) {
synchronized(this) {
lastName = name;
In this example, the addName method needs to synchronize changes to lastName and nameCount, but also needs to avoid synchronizing invocations of other objects' methods. Without synchronized statements, there would have to be a separate, unsynchronized method for the sole purpose of invoking nameList.add.
Reference: The Java Tutorial,Intrinsic Locks and Synchronization

Q: 4
Sam has designed an application. It segregates tasks that are critical and executed frequently from tasks that are non critical and executed less frequently. He has prioritized these tasks based on their criticality and frequency of execution. After close scrutiny, he finds that the tasks designed to be non critical are rarely getting executed.
From what kind of problem is the application suffering?
A. race condition
B. starvation
C. deadlock
D. livelock
Answer: C
Explanation: Starvation describes a situation where a thread is unable to gain regular access to shared resources and is unable to make progress. This happens when shared resources are made unavailable for long periods by "greedy" threads. For example, suppose an object provides a synchronized method that often takes a long time to return. If one thread invokes this method frequently, other threads that also need frequent synchronized access to the same object will often be blocked.
Reference: The Java Tutorial, Starvation and Livelock

Q: 5
Class Employee {
public int checkEmail() {/* . . . */}
public void sendEmail (String email) {/* . . . */}
public Boolean validDateEmail(){/* . . . */}
public void printLetter (String letter) {/* . . . */}
Which is correct?
A. Employee takes advantage of composition.
B. Employee "has-an" Email.
C. Employee "is-a" LetterPrinter.
D. Employee has low cohesion.
Answer: D
Explanation: The relationship between Employee and e-mail is poorly implemented here.
There is low cohesion.
Low cohesion is associated with undesirable traits such as being difficult to maintain, difficult to test, difficult to reuse, and even difficult to understand.
Cohesion is decreased if:
The functionalities embedded in a class, accessed through its methods, have little in common.
Methods carry out many varied activities, often using coarsely-grained or unrelated sets of data.
Disadvantages of low cohesion (or"weak cohesion") are:
Increased difficulty in understanding modules.
Increased difficulty in maintaining a system, because logical changes in the domain affect multiple modules, and because changes in one module require changes in related modules.
Increased difficulty in reusing a module because most applications won’t need the random set of operations provided by a module.
Reference:Cohesion (computer science)

Q: 6
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 () {}
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.

Q: 7
Given the incomplete pseudo-code for a fork/join framework application:
submit(Data) {
if(Data.size < SMALL_ENOUGH) {
_________________(Data); // line x
else {
List<Data> x = _________________(Data); // line Y
for(Data d: x
______________(d); // line z
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.
Answer: C,E,G
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).

Q: 8
ITEM Table
And given the code fragment (assuming that the SQL query is valid):
try {
String query = "SELECT * FROM Item WHERE ID=110";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
while ( ()) {
System.out.println("ID: " + rs.getInt("Id"));
System.out.println("Description: " + rs.getString("Descrip"));
System.out.println("Price: " + rs.getDouble("Price"));
System.out.println("Quantity: " + rs.getInt("Quantity"));
} catch (SQLException se) {
What is the result of compiling and executing this code?
A. An exception is thrown at runtime
B. Compile fails
C. The code prints Error
D. The code prints information about Item 110
Answer: A
Explanation: The connection conn is not defined. The code will not compile.

Q: 9
class Deeper {
public Number getDepth() {
return 10;
Which two classes correctly override the getDepth method?
A. public class deep extends Deeper {
protected integer getDepth(){
return 5;
B. public class deep extends Deeper {
public double getDepth() {
C. public class deep extends Deeper {
public String getDepth () {
D. public class deep extends Deeper {
public Long getDepth (int d) {
return 5L;
E. public class deep extends Deeper {
public short getDepth () {
return 5;
Answer: A,E
Explanation: Note:The abstract class Number is the superclass of classes Byte, Double, Float, Integer, Long, and Short.
Subclasses of Number must provide methods to convert the represented numeric value to byte, double, float, int, long, and short.
When class C extends B, we say that C is a"subclass"of B, and B is the"superclass"of C. This is called inheritence, because C inherited from B.

Q: 10
Given the code fragment:
public class App {
public static void main (String [] args){
Path path = Paths.get("C:\\education\\institute\\student\\report.txt");
System.out.println("get.Name(0): %s", path.getName(0));
System.out.println ("subpath(0, 2): %s", path.subpath (0, 2));}
What is the result?
A. getName (0): C:\
subpath (0, 2): C:\education\report.txt
B. getName(0): C:\
subpth(0, 2): C:\education
C. getName(0): education
subpath (0, 2): education\institute
D. getName(0): education
subpath(0, 2): education\institute\student
E. getName(0): report.txt
subpath(0, 2): insritute\student
Answer: C
Explanation: Example:
Path path = Paths.get("C:\\home\\joe\\foo");
-> home
Reference: The Java Tutorial, Path Operations

© 2014, All Rights Reserved