Given the following class definition with numbered lines:
How do you specify to use this mock CDI bean implementation instead of the regular implementation class?
A.
Use the alternatives element in the beans.xml file and specify the class name in the class element within it.
B.
Start up the server with the optional alternative command-line option, specifying any alternative class names in a comma-separated list.
C.
Reorder the implementation names in the beans.xml file such that the desired alternative is listed earlier.
D.
Delete the regular implementation class from the WAR.
Answer:
B
User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%
Discussions
0/ 1000
Question 2
Given the JPQL code fragment: Select pub.title, pub.author, pub.pages FROM Publisher pub Which two clauses do you add to this JPQL query to retrieve only those books with between 500 and 750 total pages? (Choose two.)
A.
WHERE MIN(pages) >= 500 AND MAX(pages) <= 750
B.
WHERE pub.pages <= 500 OR pub.pages >= 750
C.
WHERE pub.pages BETWEEN 500 AND 750
D.
WHERE pub.pages <= 500 AND pub.pages >=750
Answer:
A,B
User Votes:
A 1 votes
50%
B 1 votes
50%
C
50%
D
50%
Discussions
0/ 1000
Question 3
Give the code fragment:
And the code fragment:
The sendConfirmation() and reserve() methods should be executed in the same transactional context. Which transaction attributes do you ensure this?
A.
Add annotations:@TransactionAttribute (TransactionAttributeType.REQUIRES_NEW) at line 2,@Transactional at line 9 and@TransactionAttribute ((TransactionAttributeType.MANDATORY) at line 12
B.
No additional annotations are required.
C.
Add annotations:@TransactionAttribute (TransactionAttributeType.REQUIRED) at line 2,@Transactional at line 9 and@TransactionAttribute ((TransactionAttributeType.REQUIRES_NEW) at line 12
D.
Add annotations:@TransactionAttribute (TransactionAttributeType.MANDATORY) at line 2,@Transactional at line 9 and@TransactionAttribute ((TransactionAttributeType.REQUIRES_NEW) at line 12
Answer:
D
User Votes:
A
50%
B
50%
C
50%
D 1 votes
50%
Discussions
0/ 1000
Question 4
Given the code fragment:
What output will be returned when this servlet is called a GET request?
A.
Service() method called.
B.
Service() method called.Get() method called.
C.
An HTTP error
D.
GET() method called.
Answer:
A
User Votes:
A 1 votes
50%
B 1 votes
50%
C
50%
D
50%
Discussions
0/ 1000
Question 5
Which statement is true about Java methods that are exposed as Web Service operations by using JAX-WS API?
A.
The @WebResult annotation must exist.
B.
Method parameters and return types must be JAXB compatible.
C.
Method parameters must be declared by using @WebParam.
D.
The @WebMethod annotation must exist.
Answer:
D
User Votes:
A
50%
B 1 votes
50%
C
50%
D 1 votes
50%
Discussions
0/ 1000
Question 6
A Persistence application locks entity x with a LockModeType.PESSIMISTIC_READ lock type. Which statement is true?
A.
LockModeType.PESSIMISTIC_READ is the synonym of LockModeType.READ
B.
This operation will force serialization among transactions attempting to read the entity data.
C.
This operation will result in a TransactionRolledbackException if the lock cannot be obtained.
D.
If the application updates the entity later, and the changes are flushed to the database, the lock will be converted to an exclusive look.
You are building the User Preferences page of an application. A user can change values, such as his or her name, password, address, company, and so on. These values are sent to a CDI backing bean via AJAX when the user tabs out of each field. However, the values must be retained in the CDI bean and stored in the database only when the user clicks the Save button. Which two scopes will allow your CDI bean to retain its state while the user is interacting with the User Preferences page? (Choose two.)
A.
Dependent
B.
View
C.
Session
D.
Request
E.
Application
Answer:
C,D
User Votes:
A
50%
B
50%
C 1 votes
50%
D 1 votes
50%
E
50%
Discussions
0/ 1000
Question 8
Given:
What will be the response to a HEAD request?
A.
The findAll() method will be called and the employee list will be returned.
B.
The findAll() method will be called and no employees will be returned.
C.
No method will be invoked and no error will be returned.
D.
No method will be invoked and a 404 error will be returned.
Answer:
C
User Votes:
A
50%
B
50%
C 1 votes
50%
D
50%
Discussions
0/ 1000
Question 9
Your web application requires logic to remember items that a user placed into a shopping cart. Which two mechanisms should you use to associate that information with the user? (Choose two.)
A.
HttpServletResponse objects
B.
ServletContext objects
C.
HttpSession objects
D.
a database
Answer:
B,C
User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D 1 votes
50%
Discussions
0/ 1000
Question 10
Your class requires multiple resources defined, as shown in the following:
Which annotation do you use to group multiple @Resource declarations together for class-based injection, replacing <XXXX> in the code above?
A.
@Resources
B.
@Resource
C.
@ResourceGroup
D.
@ResourceCollection
Answer:
B
User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D
50%
Discussions
0/ 1000
Question 11
You want to allow one set of roles to POST to a resource and another set of roles to GET it. Which two configuration options should you use? (Choose two.)
A.
two separate @HttpMethodConstraints annotations and sets of roles
B.
a single @HttpMethodContstraint annotation and a map of method to roles
C.
two <web-resource-collection> with different <http-method> in the deployment descriptor
D.
a single <web-resource-collection> with two <auth-constraint> with different <http-method> in the deployment descriptor
Answer:
B,D
User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D 1 votes
50%
Discussions
0/ 1000
Question 12
Given the code fragment:
Assuming this bean is used only in the code fragment above, how long will the injected Bean instance be available?
A.
for the lifetime of the enterprise application
B.
for the lifetime of the request
C.
for the lifetime of the session
D.
for the lifetime of the Service object
Answer:
D
User Votes:
A
50%
B
50%
C 1 votes
50%
D 1 votes
50%
Discussions
0/ 1000
Question 13
Which is a valid description of REST?
A.
REST provides the same architectural properties as SOAP.
B.
REST is a library that is part of JEE called JAX-RS.
C.
REST is the conventional way of interacting with information resources.
D.
REST is a Web Services standard supported by JEE and JAX-RS.
Which annotation do you use on line 1 to ensure that clients immediately time out when attempting to concurrently invoke callMethod () while another client is already accessing the bean?
A.
@AccessTimeout (value = 1, unit = TimeUnit.SECONDS)