Oracle 1Z0-804 Online Practice
Questions and Exam Preparation
1Z0-804 Exam Details
Exam Code
:1Z0-804
Exam Name
:Java SE 7 Programmer II
Certification
:Oracle Certifications
Vendor
:Oracle
Total Questions
:150 Q&As
Last Updated
:Dec 08, 2021
Oracle 1Z0-804 Online Questions &
Answers
Question 131:
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
C. deadlock
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
Question 132:
Given the classes:
class Pupil {
String name = "unknown";
public String getName() {return name;}
}
class John extends Pupil {
String name = "John";
}
class Harry extends Pupil {
String name = "Harry";
public String getName() {return name;}
}
public class Director {
public static void main(String[] args) {
Pupil p1 = new John();
Pupil p2 = new Harry();
System.out.print(p1.getName() + " ");
System.out.print(p2.getName());
}
}
What is the result?
A. John Harry B. unknown Harry C. john unknown D. unknown unknown E. Compilation fails. F. An exception is thrown at runtime.
B. unknown Harry
Question 133:
You have been asked to create a ResourceBundle file to localize an application.
Which code example specifies valid keys menu1 and manu2 with values of File Menu and View Menu?
A. File Menu View Menu B. menu1File Menu menu1View Menu C. menu1m File menu, menu2, view menu D. menu1 = File Menu menu2 = View Menu
D. menu1 = File Menu menu2 = View Menu
A properties file is a simple text file. You can create and maintain a properties file with just about any text editor.
You should always create a default properties file. The name of this file begins with the base name of your ResourceBundle and ends with the .properties suffix. In the PropertiesDemo program the base name is LabelsBundle. Therefore the default properties file is called LabelsBundle.properties. The following example file contains the following lines:
# This is the default LabelsBundle.properties file s1 = computer s2 = disk s3 = monitor s4 = keyboard
Note that in the preceding file the comment lines begin with a pound sign (#). The other lines contain key-value pairs. The key is on the left side of the equal sign and the value is on the right. For instance, s2 is the key that corresponds to the value disk. The key is arbitrary. We could have called s2 something else, like msg5 or diskID. Once defined, however, the key should not change because it is referenced in the source code. The values may be changed. In fact, when your localizers create new properties files to accommodate additional languages, they will translate the values into various languages.
What is the result of the employees table has no records before the code executed?
A. 1 Sam B. 4 Jack C. 3 John 4 Jack D. 1 Sam 3 John 4 Jack
C. 3 John 4 Jack
Autocommit is set to false. The two following statements will be within the same transaction.
stmt.executeUpdate("insert into employees values(1,'Sam')");
stmt.executeUpdate("insert into employees values(2,'Jane')");
These two statements are rolled back through (the savepoint is ignored -the savepoint must be specified in the rollback if you want to rollback to the savepoint):
conn.rollback();
The next two insert statements are executed fine. Their result will be in the output.
Question 138:
Given these facts about Java types in an application:
-
Type x is a template for other types in the application.
-
Type x implements dostuff ().
-
Type x declares, but does NOT implement doit().
-
Type y declares doOther() . Which three are true?
A. Type y must be an interface. B. Type x must be an abstract class. C. Type y must be an abstract class. D. Type x could implement or extend from Type y. E. Type x could be an abstract class or an interface. F. Type y could be an abstract class or an interface.
B. Type x must be an abstract class. D. Type x could implement or extend from Type y. F. Type y could be an abstract class or an interface.
Unlike interfaces, abstract classes can contain fields that are not static and final, and they can contain implemented methods. Such abstract classes are similar to interfaces, except that they provide a partial implementation, leaving it to
subclasses to complete the implementation. If an abstract class contains only abstract method declarations, it should be declared as an interface instead.
Note:
An interface in the Java programming language is an abstract type that is used to specify an interface (in the generic sense of the term) that classes must implement. Interfaces are declared using the interface keyword, and may only contain
method signature and constant declarations (variable declarations that are declared to be both static and final). An interface may never contain method definitions.
Note 2: an abstract class is a class that is declared abstract--it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.
An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon)
Question 139:
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.
A. A JdbcRowSet object provides a JavaBean view of a result set. C. A FilteredRowSet object filter can be modified at any time.
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 database using 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 object are detected. A new filter has 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 140:
Given the database table:
And given this class:
Assume that the SQL integer queries are valid. What is the result of compiling and executing this code fragment? Refer to the exhibit.
A. A B. B C. C D. D E. E
C. C
The code will compile now.
The three rows with PRICE in between 5.5 and 9.5 will be displayed.
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Oracle exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your 1Z0-804 exam preparations
and Oracle certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.