1Z0-804 Guide

1Z0-804 Exam Royal Pack (In Stock.)

 
  • Oracle
  • Exam Number/Code 1Z0-804
  • Product Name Java SE 7 Programmer II Exam
  • Questions and Answers
  • 150 Q&As
  • Last Updated
  • Dec 12,2017
  • List Price
  • $128.99
  • Price
  • Today 49.99 USD

Free TrialVersion: demo Buy Now 50% OFF

Top Best Quality 1Z0-804 Q&A Tips!

Examcollection 1Z0-804 Questions are updated and all 1Z0-804 answers are verified by experts. Once you have completely prepared with our 1Z0-804 exam prep kits you will be ready for the real 1Z0-804 exam without a problem. We have Most recent Oracle 1Z0-804 dumps study guide. PASSED 1Z0-804 First attempt! Here What I Did.

Q31. Given the code fragment: What is the result when infected() is invoked? 

A. before try catch finally after 

B. before catch finally after 

C. before catch after 

D. before catch finally 

E. before catch 

Answer:

Explanation: 

The following line throws and exception: 

int i = 1/0; 

This exception is caught by: 

catch(Exception e) { 

System.out.print("catch "); 

throw e; 

Lastly, the finally statement is run as the finally block always executes when the try block 

exits. This ensuresthat the finally block is executed even if an unexpected exception 

occurs. 

Reference: Java Tutorial,The finally Block 


Q32. Given: 

Which statement will iterate through Direction? 

A. for (Direction d : Direction.values()){ // 

B. for (Direction d : Direction.asList()){ 

// 

C. for (Direction d : Direction.iterator()){ 

// 

D. for (Direction d : Direction.asArray()){ 

// 

Answer:

Explanation: 

The static values() method of an enum type returns an array of the enum values. The 

foreach loop is a good 

way to go over all of them. 

//... Loop over all values. 

for (Direction d : Direction.values()){ 

System.out.println(d); // PrintsNORTH, EAST, ... 


Q33. Given: 

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() { 

return 5d; 

}} 

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. 


Q34. Given the code fragment: Which code fragment inserted at line ***, enables the code to compile? 

A. public void process () throws FileNotFoundException, IOException { super.process (); 

while ((record = br.readLine()) !=null) { 

System.out.println(record); 

}} 

B. public void process () throws IOException { 

super.process (); 

while ((record = br.readLine()) != null) { 

System.out.println(record); 

}} 

C. public void process () throws Exception { 

super.process (); 

while ((record = br.readLine()) !=null) { 

System.out.println(record); 

}} 

D. public void process (){ 

try { 

super.process (); 

while ((record = br.readLine()) !=null) { 

System.out.println(record); 

} catch (IOException | FileNotFoundException e) { } 

E. public void process (){ 

try { 

super.process (); 

while ((record = br.readLine()) !=null) { 

System.out.println(record); 

} catch (IOException e) {} 

Answer:

Explanation: 

A: Compilation fails: Exception IOException is not compatible with throws clause in Base.process() 

B: Compilation fails: Exception IOException is not compatible with throws clause in Base.process() 

C: Compilation fails: Exception Exception is not compatible with throws clause in Base.process() 

D: Compilation fails: Exception FileNotFoundException has already been caught by the alternative IOException Alternatives in a multi-catch statement cannot be related to subclassing Alternative java.io.FileNotFoundException is a subclass of alternative java.io.IOException 

E: compiles ... 


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

Answer: A,C 

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 


Q36. What will the following class print when run? 

A. javajava 

B. lavajava 

C. javajavac 

D. lavajavac 

E. None of these. 

Answer:


Q37. Given: 

What is the result? 

A. Compilation fails. 

B. 78class java.lang.Array.IndexOutOfBoundException 

C. class MarkOutOfBoundException 

D. class java.lang.arrayIndexOutOfBoundException 

Answer:

Explanation: 

The exception MarkOutOfBoundsException is already caught by the alternative ArrayIndexOutOfBoundsException 


Q38. To provide meaningful output for: 

System.out.print( new Item ()): 

A method with which signature should be added to the Item class? 

A. public String asString() 

B. public Object asString() 

C. public Item asString() 

D. public String toString() 

E. public object toString() 

F. public Item toString() 

Answer:

Explanation: 

Implementing toString method in java is done by overriding the Object's toString method. 

The javatoString() method is used when we need a string representation of an object. It is 

defined in Object class. Thismethod can be overridden to customize the String 

representation of the Object. 

Note: 

Below is an example shown of Overriding the default Object toString() method. The 

toString() method must bedescriptive and should generally cover all the contents of the 

object. 

class PointCoordinates { 

private int x, y; 

public PointCoordinates(int x, int y) { 

this.x = x; 

this.y = y; 

public int getX() { 

return x; 

public int getY() { 

return y; 

// Custom toString() Method. 

public String toString() { 

return "X=" + x + " " + "Y=" + y; 

}} 


Q39. Which type of ExecutorService supports the execution of tasks after a fixed delay? 

A. DelayedExecutorService 

B. ScheduledExecutorService 

C. TimedExecutorService D. FixedExecutorService 

E. FutureExecutorService 

Answer:

Explanation: 

The ScheduledExecutorService interface supplements the methods of its parent 

ExecutorService withschedule, which executes a Runnable or Callable task after a 

specified delay. In addition, the interface definesscheduleAtFixedRate and 

scheduleWithFixedDelay, which executes specified tasks repeatedly, at definedintervals. 

Note:The java.util.concurrent package defines three executor interfaces: 

*Executor, a simple interface that supports launching new tasks. *ExecutorService, a 

subinterface of Executor,which adds features that help manage the lifecycle, both of the 

individual tasks and of the executor itself. 

*ScheduledExecutorService, a subinterface of ExecutorService, supports future and/or 

periodic execution oftasks. 

Reference: The Java Tutorials,Executor Interfaces 


Q40. Given: Which three values will appear in the output? 

A. 5 

B. 7 

C. a1 

D. a2 

E. b1 

F. b2 

Answer: A,D,E 

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; 


To know more about the 1Z0-804, click here.

Tagged as : Oracle 1Z0-804 Dumps, Download 1Z0-804 pdf, 1Z0-804 VCE, 1Z0-804 pass4sure, examcollection 1Z0-804