Review the following scenario; then identify which security mechanisms would be important to fulfill the requirement. (Choose one.)

Review the following scenario; then identify which security mechanisms would be important to fulfill the requirement. (Choose one.)


An online magazine company wishes to protect part of its website content, to make that part available only to users who pay a monthly subscription. The company wants to keep client,
network, and server processing overheads down: Theft of content is unlikely to be an issue, as is abuse of user IDs and passwords through network snooping.


a. Authorization and Authentication
b. Indication
c. Client certification
d. Data integrity
e. Confidentiality








Answer: A

Which statements are BEST describe name attribute of action?

Which statements are BEST describe name attribute of <jsp:setProperty name=.... /> action?




a. The ID of the JavaBean for which a property (or properties) will be set.
b. The name of the property to set. Specifying "*" for this attribute causes the JSP to match the request parameters to the properties of the bean.
c. If request parameter names do not match bean property names, this attribute can be used to specify which request parameter should be used to obtain the value for a specific bean property.
d. The value to assign to a bean property. The value typically is the result of a JSP expression.








Answer: A

Which statements are BEST describe response implicit object of jsp file?

Which statements are BEST describe response implicit object of jsp file?



a. This javax.servlet.jsp.JspWriter object writes text as part of the response to a request. This object is used implicitly with JSP expressions and actions that insert string content in a response.

b. This java.lang.Object object represents the this reference for the current JSP instance.

c. This javax.servlet.jsp.PageContext object hides the implementation details of the underlying servlet and JSP container and provides JSP programmers with access to the implicit objects discussed in this table.

d. This object represents the response to the client. The object normally is an
instance of a class that implements HttpServletResponse (package javax.servlet.http). If a protocol other than HTTP is used, this object is an instance of a class that implements javax.servlet.ServletResponse.

e. This object represents the client request. The object normally is an instance of a class that implements HttpServletRequest (package javax.servlet.http). If a protocol other than HTTP is used, this object is an instance of a subclass of javax.servlet.ServletRequest.








Answer: D

Which statements are BEST describe request implicit object of jsp file?

Which statements are BEST describe request implicit object of jsp file?




a. This javax.servlet.jsp.JspWriter object writes text as part of the response to a request. This object is used implicitly with JSP expressions and actions that insert string content in a response.
b. This java.lang.Object object represents the this reference for the current JSP instance.
c. This javax.servlet.jsp.PageContext object hides the implementation details of the underlying servlet and JSP container and provides JSP programmers with access to the implicit objects discussed in this table.
d. This object represents the response to the client. The object normally is an
instance of a class that implements HttpServletResponse (package javax.servlet.http). If a protocol other than HTTP is used, this object is an instance of a class that implements javax.servlet.ServletResponse.
e. This object represents the client request. The object normally is an instance of a class that implements HttpServletRequest (package javax.servlet.http). If a protocol other than HTTP is used, this object is an instance of a subclass of javax.servlet.ServletRequest.






Answer: E



JavaServer Pages (JSP) technology enables you to mix regular, static HTML with dynamically generated content from servlets. You simply write the regular HTML in the normal manner, using familiar Web-page-building tools.

JavaServer Pages (JSP) technology enables you to mix regular, static HTML with dynamically generated content from servlets. You simply write the regular HTML in the normal manner, using familiar Web-page-building tools. 



a. True
b. False






Answer: A

A JSP page called test.jsp is passed a parameter name in the URL using http://localhost/Final/test.jsp?name=John. The test.jsp contains the following code.

A JSP page called test.jsp is passed a parameter name in the URL using http://localhost/Final/test.jsp?name=John. The test.jsp contains the following code.


<% String myName=request.getParameter("name");%>
<% String test= "Welcome " + myName; %>
<%=test%>

What is the output?
a. The page display "Welcome John"
b. The program gives a syntax error because of the statement
<% String myName=request.getParameter("name");%>
c. The program gives a syntax error because of the statement
<% String test= "Welcome " + myName; %>
d. The program gives a syntax error because of the statement
<%=test%>




Answer: A 

How can you ensure the continuity of the session while using HttpServletResponse.sendRedirect() method when cookies are not supported by the client?

How can you ensure the continuity of the session while using HttpServletResponse.sendRedirect() method when cookies are not supported by the client? 



a. By using hidden parameters.
b. By encoding the redirect path with HttpServletResponse.encodeRedirectURL() method.
c. By using HttpServletRequest.encodeURL() method.







Answer: B

Study the statements: 1) The context path contains a special directory called WEB-INF, which contains the deployment descriptor file, web.xml. 2) A client application may directly access resources in WEB-INF or its subdirectories through HTTP.

Study the statements:
1) The context path contains a special directory called WEB-INF, which contains the deployment descriptor file, web.xml.
2) A client application may directly access resources in WEB-INF or its subdirectories through HTTP. 




a. Only statement 1 is true
b. Only statement 2 is true
c. Both 1 and 2 are true
d. Both 1 and 2 are not true






Answer: A

Which of the following methods can be used to add cookies to a servlet response?

Which of the following methods can be used to add cookies to a servlet response?




a. HttpServletResponse.addCookie(Cookie cookie)
b. ServletResponse.addCookie(Cookie cookie)
c. HttpServletResponse.addCookie(String contents)
d. ServletResponse.addCookie(String contents)
e. ServletResponse.addHeader(String name, String value)







Answer: A

You have to send a gif image to the client as a response to a request. Which of the following calls will you have to make? (Choose one)

You have to send a gif image to the client as a response to a request. Which of the following calls will you have to make? (Choose one)




a. response.setContentType("image/gif");
b. response.setType("application/gif");
c. response.setContentType("application/bin");
d. response.setType("image/gif");






Answer: A

(10110) Following is the code for doGet() and doPost() method of TestServlet. Which of the statement is correct?

(10110) Following is the code for doGet() and doPost() method of TestServlet.
Which of the statement is correct?





a. This will only work for HTTP GET requests
b. This will only work for HTTP POST requests
c. This will work for HTTP GET as well as POST requests.
d. It'll throw an exception at runtime, as you cannot call doGet() from doPost().
e. It'll throw an exception at runtime only if a POST request is sent to it.






Answer: C

Which is the CORRECT statement about JMS?

Which is the CORRECT statement about JMS?



a. JMS uses JNDI to find destination
b. JMS enhances access to email services
c. JMS uses JMX to create a connectionFactory







Answer: A

Which statement about JMS is true?

Which statement about JMS is true?




a. JMS supports Publish/Subscribe
b. JMS enhances access to email services
c. JMS uses JMX to create a connectionFactory






Answer: A

Which statement is correct about Java EE client of a message-driven beans?

Which statement is correct about Java EE client of a message-driven beans?



a. The client can use JNDI to obtain a reference to a message destination
b. The client can use JNDI to obtain a reference to a dependency injection
c. The client can use JNDI to obtain a reference to a message-driven bean instance








Answer: A

Which statement describe about Message-Driven Beans is correct? (Choose one)

Which statement describe about Message-Driven Beans is correct? (Choose one)




a. Message-Driven Beans are stateful
b. An EJB 3.0 message-driven beans can itself be the client of another message-driven beans
c. The bean mediates between the client and the other components of the application, presenting a simplified view to the client.






Answer: B

Which is true about JDBC?

Which is true about JDBC?



a. All JDBC drivers are pure Java.
b. The JDBC API is included in J2SE
c. The JDBC API is an extension of the ODBC API
d. JDBC is used to connect to MOM (Message-Oriented Middleware Product)







Answer: B

Which is true about RMI?

Which is true about RMI?



a. RMI is used to create thin web client
b. RMI allows objects to be send from one computer to another
c. RMI is the Java API used for executing queries on a database
d. RMI is the transport protocol used by web servers and browsers






Answer: B

Which statement is NOT true about JMS?

Which statement is NOT true about JMS?




a. JMS does NOT depend on MOM (Messaging-Oriented Middleware) products
b. JSM support an event oriented approach to message reception.
c. JMS support both synchronous and asynchronous message passing
d. JMS provides common way for Java programs to access an enterprise messaging system's message







Answer: A

A developer wants to achieve the following two behaviors for an EJB 3.0 session bean:

A developer wants to achieve the following two behaviors for an EJB 3.0 session bean:

(1) If the client calls a business method with a transaction context, the container will invoke the enterprise
bean's method in the client's transaction context.
(2) If the client calls a business method without a transaction context, the container will throw the
javax.ejb.EJBTransactionRequiredException.
Which transaction attribute should be used?



a. MANDATORY
b. SUPPORTS
c. NOT_SUPPORTED






Answer: A

Which statement about entity manager is true?

Which statement about entity manager is true?



a. A container-managed entity manager must be a JTA entity manager.
b. An entity manager injected into session beans can use either JTA or resource-local transaction control.
c. An entity manager created by calling the EntityManagerFactory.createEntityManager method always uses JTA transaction control.







Answer: A

Which statement about an entity instance lifecycle is correct?

Which statement about an entity instance lifecycle is correct?




a. A new entity instance is an instance with a fully populated state.
b. A detached entity instance is an instance with no persistent identity.
c. A removed entity instance is NOT associated with a persistence context.
d. A managed entity instance is the instance associated with a persistence context.






Answer: D

Which of the following lines of code are correct? (Choose one)

Which of the following lines of code are correct? (Choose one)




a. @Entity
public class Company{
...
}
public class Employee extends Company{
...
}
b. @Entity
public class Company{
...
}
@Entity
public class Employee extends Company{
...
}
c. public class Company{
...
}
@Entity
public class Employee extends Company{
...
}
d. All of others




Answer: D

If you want to send an entity object as the pass by value through a remote interface, which of the following statements are valid? (Choose one)

If you want to send an entity object as the pass by value through a remote interface, which of the following statements are valid? (Choose one)




a. @Entity
public class Employees implements SessionSynchronization{
...
}
b. @Entity
public class Employees implements Serializable{
...
}
c. public class Employees implements Serializable{
...
}
d. @entity
public class Employees implements Serializable{
...
}


Answer: B




Which of the following lines of code are correct?

Which of the following lines of code are correct?





a. @EntityBean
public class Employees{
...
}


b. @Entity
public class Employees{
...
}



c. class Employees{
@Entity
private class Address{
...
}
...
}







Answer: B

The Java Persistent API defines the Query interface. Which statement is true about the Query.executeUpdate method ?

The Java Persistent API defines the Query interface. Which statement is true about the Query.executeUpdate method ?



a. It must always be executed within a transaction
b. It throws a PersistenceException if no entities were updated.
c. All managed entity objects corresponding to database rows affected by the update will have their state changed to correspond with the update




Answer: A

A developer wants to use the Java Persistence query language. Which statement is true?

A developer wants to use the Java Persistence query language. Which statement is true?




a. A WHERE clause is required in every query
b. The WHERE clause can be used to order the results returned by the query.
c. The WHERE clause is used to determine the types of objects to be retrieved from persistent store
d. The WHERE clause is used to restrict the contents of a collection of objects that are returned from a query.







Answer: D

Which statement is true about the use of a persist operation in a transaction of an Entity Beans

Which statement is true about the use of a persist operation in a transaction of an Entity Beans



a. If a user persists a detached object it always becomes managed
b. The persist operation on an entity always cascades to its related entities
c. If a user persists a new entity with an existing primary key the transaction will fail
d. If a user persists a managed entity an exception may be thrown by the persist operation





Answer: C


The requirement for an online shopping application are: It must support millions of customers. The invocations must be transactional. The shopping cart must be persistent. Which technology is required to support these requirements?

The requirement for an online shopping application are:
It must support millions of customers. The invocations must be transactional. The shopping cart must be persistent. Which technology is required to support these requirements? 




a. JNI
b. JMS
c. EJB
d. JMX






Answer: C

Which is NOT a correct statement about entity beans?

Which is NOT a correct statement about entity beans?



a. They are used to store persistent data
b. They are used to share data among clients
c. They are used to implement business processes
d. They are used to represent data stored in a RDBMS




Answer: C




A developer wants to create a Java Persistence query that returns valid US phone numbers (formatted as 123-456-7890) from a collection of differently formatted international phone numbers. The developer needs only those numbers that begin with 303. Which WHERE clause is correct?

A developer wants to create a Java Persistence query that returns valid US phone numbers (formatted as 123-456-7890) from a collection of differently formatted international phone numbers. The developer needs only those numbers that begin with 303. Which WHERE clause is correct?




a. WHERE addr.phone LIKE '303_'
b. WHERE addr.phone LIKE '303%'
c. WHERE addr.phone LIKE '303-%-%'
d. WHERE addr.phone LIKE '303-___-____'






Answer: D

A developer is working on a project that includes both EJB 2.1 and EJB 3.0 session beans. A lot of business logic has been implemented and tested in these EJB 2.1 session beans. Some EJB 3.0 session beans need to access this business logic. Which design approach can achieve this requirement?

A developer is working on a project that includes both EJB 2.1 and EJB 3.0 session beans. A lot of business logic has been implemented and tested in these EJB 2.1 session beans.
Some EJB 3.0 session beans need to access this business logic.
Which design approach can achieve this requirement?





a. Add adapted home interfaces to EJB 3.0 session beans to make EJB 3.0 and EJB 2.1 session beans interoperable.
b. Add EJB 3.0 business interfaces to existing EJB 2.1 session beans and inject references to these business interfaces into EJB 3.0 session beans.
c. No need to modify existing EJB 2.1 session beans. Use the @EJB annotation to inject a reference to the EJB 2.1 home interface into the EJB 3.0 bean class.






Answer: C

A developer is working on a user registration application using EJB 3.0. A business method registerUser in stateless session bean RegistrationBean performs the user registration. The registerUser method executes in a transaction context started by the client. If some invalid user data causes the registration to fail, the client invokes registerUser again with corrected data using the same transaction. Which design can meet this requirement?

A developer is working on a user registration application using EJB 3.0. A business method registerUser in stateless session bean RegistrationBean performs the user registration.
The registerUser method executes in a transaction context started by the client. If some invalid user data causes the registration to fail, the client invokes registerUser again with corrected data using the same transaction. Which design can meet this requirement?



a. Have registerUser method call EJBContext.setRollbackOnly() method after registration fails.
b. Have registerUser method throw javax.ejb.EJBTransactionRequiredException after registration fails.
c. Have registerUser method throw EJBException without marking the transaction for rollback, after registration fails.
d. Create an application exception with the rollback attribute set to false and have registerUser method throw it after registration fails.





Answer: D

What do you need to create a EJB3 session bean?

What do you need to create a EJB3 session bean?



a. Annotate the session bean with @Session
b. Annotate the session bean with @SessionBean
c. Annotate the session bean with @Stateful or @Stateless






Answer: C

Which statement is true about EJB 3.0 stateful session beans and stateless session beans? (Choose one)

Which statement is true about EJB 3.0 stateful session beans and stateless session beans? (Choose one)



a. Both can have multiple remote and local business interfaces
b. Only the stateful session bean class is required to implement java.io.Serializable interface
c. Both can be passivated by the EJB container to preserve resource
d Only the stateless session bean class is required to implement java.io.Serializable interface






Answer: A

Which statement is true about the EJB 3.0 stateful session beans?

Which statement is true about the EJB 3.0 stateful session beans?



a. Its conversational state is retained across method invocations and transactions
b. Its conversational state is lost after passivation unless the bean class saves it to a database
c. Its conversational state is retained across method invocations but NOT across transaction boundaries






Answer: A

A developer must implement a "shopping cart" object for a web-based application. The shopping cart must be able to maintain the state of the cart, but the state is not stored persistently. Which JEE (J2EE) technology is suited to this goal?

A developer must implement a "shopping cart" object for a web-based application. The shopping cart must be able to maintain the state of the cart, but the state is not stored persistently. Which JEE (J2EE) technology is suited to this goal?



a. JMS
b. Entity beans
c. Stateful session beans
d. Stateless session beans






Answer: C

Which is NOT true about stateless session beans?

Which is NOT true about stateless session beans?



a. They are CANNOT hold client state
b. They are used to implement business logic
c. They are used to represent data stored in a RDBMS
d. They are an Enterprises Beans




Answer: C

Which statement is true about management of an EJB's resources?

Which statement is true about management of an EJB's resources?




a. The reference to home object is obtained through JNDI to improve maintainability and flexibility.
b. The reference to the remote object is obtained through JNDI to improve maintainability and flexibility.






Answer: A

Which statement is true about EJB 3.0 containers?

Which statement is true about EJB 3.0 containers?



a. javax.naming.initialContext is guaranteed to provide a JNDI name space
b. Java Telephony API is guaranteed to be available for session and message beans
c. The Java 2D API is guaranteed to be available for session beans





Answer: A

What is the purpose of JNDI?

What is the purpose of JNDI?



a. To parse XML documents
b. To access native code from Java application
c. To register Java Web Start applications with a web server
d. To access various directory services using a single interface





Answer: D

Which is true about JEE ( or J2EE)?

Which is true about JEE ( or J2EE)?



a. JEE applications depend on web servers
b. JEE runs on consumer and embedded devices
c. JEE includes servlet APIs and EJB APIs
d. JEE can be run only on tomcat web servers




Answer: C


Which is the CORRECT statement about JMS?

Which is the CORRECT statement about JMS?



a. JMS uses JNDI to find destination
b. JMS enhances access to email services
c. JMS uses JMX to create a connectionFactory






Answer: A

Which statement about JMS is true?

Which statement about JMS is true?



a. JMS supports Publish/Subscribe
b. JMS enhances access to email services
c. JMS uses JMX to create a connectionFactory






Answer: A

Which statement is correct about Java EE client of a message-driven beans?

Which statement is correct about Java EE client of a message-driven beans?



a. The client can use JNDI to obtain a reference to a message destination
b. The client can use JNDI to obtain a reference to a dependency injection
c. The client can use JNDI to obtain a reference to a message-driven bean instance






Answer: A

Which statement describe about Message-Driven Beans is correct? (Choose one)

Which statement describe about Message-Driven Beans is correct? (Choose one)




a. Message-Driven Beans are stateful
b. An EJB 3.0 message-driven beans can itself be the client of another message-driven beans
c. The bean mediates between the client and the other components of the application, presenting a simplified view to the client.





Answer: B

Which is true about JDBC?

Which is true about JDBC?




a. All JDBC drivers are pure Java.
b. The JDBC API is included in J2SE
c. The JDBC API is an extension of the ODBC API
d. JDBC is used to connect to MOM (Message-Oriented Middleware Product)






Answer: B

Which is true about RMI?

Which is true about RMI?



a. RMI is used to create thin web client
b. RMI allows objects to be send from one computer to another
c. RMI is the Java API used for executing queries on a database
d. RMI is the transport protocol used by web servers and browsers






Answer: B

Which statement is NOT true about JMS?

Which statement is NOT true about JMS?






a. JMS does NOT depend on MOM (Messaging-Oriented Middleware) products
b. JSM support an event oriented approach to message reception.
c. JMS support both synchronous and asynchronous message passing
d. JMS provides common way for Java programs to access an enterprise messaging system's message






Answer: A

A developer wants to achieve the following two behaviors for an EJB 3.0 session bean: (1) If the client calls a business method with a transaction context, the container will invoke the enterprise bean's method in the client's transaction context. (2) If the client calls a business method without a transaction context, the container will throw the javax.ejb.EJBTransactionRequiredException. Which transaction attribute should be used?

A developer wants to achieve the following two behaviors for an EJB 3.0 session bean:
(1) If the client calls a business method with a transaction context, the container will invoke the enterprise
bean's method in the client's transaction context.
(2) If the client calls a business method without a transaction context, the container will throw the
javax.ejb.EJBTransactionRequiredException.
Which transaction attribute should be used?






a. MANDATORY
b. SUPPORTS
c. NOT_SUPPORTED








Answer: A

Which statement about entity manager is true?

Which statement about entity manager is true?



a. A container-managed entity manager must be a JTA entity manager.
b. An entity manager injected into session beans can use either JTA or resource-local transaction control.
c. An entity manager created by calling the EntityManagerFactory.createEntityManager method always uses JTA transaction control.







Answer: A

Which statement about an entity instance lifecycle is correct?

Which statement about an entity instance lifecycle is correct?




a. A new entity instance is an instance with a fully populated state.
b. A detached entity instance is an instance with no persistent identity.
c. A removed entity instance is NOT associated with a persistence context.
d. A managed entity instance is the instance associated with a persistence context.







Answer: D

Which of the following lines of code are correct? (Choose one)

Which of the following lines of code are correct? (Choose one)





a. @Entity
public class Company{
...
}
public class Employee extends Company{
...
}
b. @Entity
public class Company{
...
}
@Entity
public class Employee extends Company{
...
}
c. public class Company{
...
}
@Entity
public class Employee extends Company{
...
}
d. All of others






Answer: D

If you want to send an entity object as the pass by value through a remote interface, which of the following statements are valid? (Choose one)

If you want to send an entity object as the pass by value through a remote interface, which of the following statements are valid? (Choose one)




a. @Entity
public class Employees implements SessionSynchronization{
...
}
b. @Entity
public class Employees implements Serializable{
...
}
c. public class Employees implements Serializable{
...
}
d. @entity
public class Employees implements Serializable{
...
}






Answer: B

Which of the following lines of code are correct?

Which of the following lines of code are correct?





a. @EntityBean
public class Employees{
...
}
b. @Entity
public class Employees{
...
}
c. class Employees{
@Entity
private class Address{
...
}
...
}





Answer: B

The Java Persistent API defines the Query interface. Which statement is true about the Query.executeUpdate method ?

The Java Persistent API defines the Query interface. Which statement is true about the Query.executeUpdate method ?



a. It must always be executed within a transaction
b. It throws a PersistenceException if no entities were updated.
c. All managed entity objects corresponding to database rows affected by the update will have their state changed to correspond with the update






Answer: A

A developer wants to use the Java Persistence query language. Which statement is true?

A developer wants to use the Java Persistence query language. Which statement is true?




a. A WHERE clause is required in every query
b. The WHERE clause can be used to order the results returned by the query.
c. The WHERE clause is used to determine the types of objects to be retrieved from persistent store
d. The WHERE clause is used to restrict the contents of a collection of objects that are returned from a query.







Answer: D

Which statement is true about the use of a persist operation in a transaction of an Entity Beans

Which statement is true about the use of a persist operation in a transaction of an Entity Beans



a. If a user persists a detached object it always becomes managed
b. The persist operation on an entity always cascades to its related entities
c. If a user persists a new entity with an existing primary key the transaction will fail
d. If a user persists a managed entity an exception may be thrown by the persist operation







Answer: C

The requirement for an online shopping application are: It must support millions of customers. The invocations must be transactional. The shopping cart must be persistent. Which technology is required to support these requirements?

The requirement for an online shopping application are:
It must support millions of customers. The invocations must be transactional. The shopping cart must be persistent. Which technology is required to support these requirements? 




a. JNI
b. JMS
c. EJB
d. JMX







Answer: C

Which is NOT a correct statement about entity beans?

Which is NOT a correct statement about entity beans?



a. They are used to store persistent data
b. They are used to share data among clients
c. They are used to implement business processes
d. They are used to represent data stored in a RDBMS







Answer: C

A developer wants to create a Java Persistence query that returns valid US phone numbers (formatted as 123-456-7890) from a collection of differently formatted international phone numbers. The developer needs only those numbers that begin with 303. Which WHERE clause is correct?

A developer wants to create a Java Persistence query that returns valid US phone numbers (formatted as 123-456-7890) from a collection of differently formatted international phone numbers. The developer needs only those numbers that begin with 303. Which WHERE clause is correct?




a. WHERE addr.phone LIKE '303_'
b. WHERE addr.phone LIKE '303%'
c. WHERE addr.phone LIKE '303-%-%'
d. WHERE addr.phone LIKE '303-___-____'






Answer: D

A developer is working on a project that includes both EJB 2.1 and EJB 3.0 session beans. A lot of business logic has been implemented and tested in these EJB 2.1 session beans. Some EJB 3.0 session beans need to access this business logic. Which design approach can achieve this requirement?

A developer is working on a project that includes both EJB 2.1 and EJB 3.0 session beans. A lot of business logic has been implemented and tested in these EJB 2.1 session beans.
Some EJB 3.0 session beans need to access this business logic.
Which design approach can achieve this requirement?




a. Add adapted home interfaces to EJB 3.0 session beans to make EJB 3.0 and EJB 2.1 session beans interoperable.
b. Add EJB 3.0 business interfaces to existing EJB 2.1 session beans and inject references to these business interfaces into EJB 3.0 session beans.
c. No need to modify existing EJB 2.1 session beans. Use the @EJB annotation to inject a reference to the EJB 2.1 home interface into the EJB 3.0 bean class.







Answer: C

A developer is working on a user registration application using EJB 3.0. A business method registerUser in stateless session bean RegistrationBean performs the user registration. The registerUser method executes in a transaction context started by the client. If some invalid user data causes the registration to fail, the client invokes registerUser again with corrected data using the same transaction. Which design can meet this requirement?

A developer is working on a user registration application using EJB 3.0. A business method registerUser in stateless session bean RegistrationBean performs the user registration.
The registerUser method executes in a transaction context started by the client. If some invalid user data causes the registration to fail, the client invokes registerUser again with corrected data using the same transaction. Which design can meet this requirement?




a. Have registerUser method call EJBContext.setRollbackOnly() method after registration fails.
b. Have registerUser method throw javax.ejb.EJBTransactionRequiredException after registration fails.
c. Have registerUser method throw EJBException without marking the transaction for rollback, after registration fails.
d. Create an application exception with the rollback attribute set to false and have registerUser method throw it after registration fails.






Answer: D

What do you need to create a EJB3 session bean?

What do you need to create a EJB3 session bean?



a. Annotate the session bean with @Session
b. Annotate the session bean with @SessionBean
c. Annotate the session bean with @Stateful or @Stateless







Answer: C

Which statement is true about EJB 3.0 stateful session beans and stateless session beans? (Choose one)

Which statement is true about EJB 3.0 stateful session beans and stateless session beans? (Choose one)





a. Both can have multiple remote and local business interfaces
b. Only the stateful session bean class is required to implement java.io.Serializable interface
c. Both can be passivated by the EJB container to preserve resource
d Only the stateless session bean class is required to implement java.io.Serializable interface







Answer: A

Which statement is true about the EJB 3.0 stateful session beans?

Which statement is true about the EJB 3.0 stateful session beans?



a. Its conversational state is retained across method invocations and transactions
b. Its conversational state is lost after passivation unless the bean class saves it to a database
c. Its conversational state is retained across method invocations but NOT across transaction boundaries







Answer: A

A developer must implement a "shopping cart" object for a web-based application. The shopping cart must be able to maintain the state of the cart, but the state is not stored persistently. Which JEE (J2EE) technology is suited to this goal?

A developer must implement a "shopping cart" object for a web-based application. The shopping cart must be able to maintain the state of the cart, but the state is not stored persistently. Which JEE (J2EE) technology is suited to this goal?



a. JMS
b. Entity beans
c. Stateful session beans
d. Stateless session beans






Answer: C

Which is NOT true about stateless session beans?

Which is NOT true about stateless session beans?



a. They are CANNOT hold client state
b. They are used to implement business logic
c. They are used to represent data stored in a RDBMS
d. They are an Enterprises Beans






Answer: C

Which statement is true about management of an EJB's resources?

Which statement is true about management of an EJB's resources?




a. The reference to home object is obtained through JNDI to improve maintainability and flexibility.
b. The reference to the remote object is obtained through JNDI to improve maintainability and flexibility.







Answer: A

Which statement is true about EJB 3.0 containers?

Which statement is true about EJB 3.0 containers?



a. javax.naming.initialContext is guaranteed to provide a JNDI name space
b. Java Telephony API is guaranteed to be available for session and message beans
c. The Java 2D API is guaranteed to be available for session beans






Answer: A

What is the purpose of JNDI?

What is the purpose of JNDI?



a. To parse XML documents
b. To access native code from Java application
c. To register Java Web Start applications with a web server
d. To access various directory services using a single interface







Answer: D

Which is true about JEE ( or J2EE)?

Which is true about JEE ( or J2EE)?



a. JEE applications depend on web servers
b. JEE runs on consumer and embedded devices
c. JEE includes servlet APIs and EJB APIs
d. JEE can be run only on tomcat web servers







Answer: C