• Post Reply Bookmark Topic Watch Topic
  • New Topic

interesting j2ee questions, please help urgent !!

 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
14)
An EJB business method performs an operation that throws a checked exception. The bean cannot
recover from this checked exception and should rollback. The bean will be deployed using
container-managed transaction demarcation. Which implementation is the BEST?

a) public void businessMethod() { try { // operation throwing SomeCheckedException goes here }
catch (SomeCheckedException ae) { throw new EJBException(ae); } }

b) public void businessMethod() { try { // operation throwing SomeCheckedException goes here }
catch (SomeCheckedException ae) { context.setRollbackOnly(); throw new EJBException(ae); } }

c) public void businessMethod() throws EJBException { try { // operation throwing SomeCheckedException goes here }
catch (SomeCheckedException ae) { throw new EJBException(ae); } }

d) public void businessMethod() throws EJBException { try { // operation throwing SomeCheckedException goes here }
catch (SomeCheckedException ae) { context.setRollbackOnly(); throw new EJBException(ae); } } }

Single Select - Please select the best answer (one and only one choice must be selected).
my answer - b)
12)
Which of the following are true regarding BMP Entity beans?

a) Persistent fields can be declared private.

b) The ejbFindByPrimaryKey() method returns void.

c) Finder methods are implemented at deployment time.

d) A record should be inserted into the database during ejbCreate().
Multiple Select - Please select all of the correct answers (this question has 2 correct choices).
my answer - a), d)
6)
A servlet counts the number of times it has been called using an incrementCount() method.
During testing, the developer verifies that the servlet accurately counts the requests from
a number of clients. Which of the following BEST explains this fact?
a) The web or application server supports activation and passivation of the servlet.

b) The HttpServlet class is designed to share state data across all its instances.

c) The same servlet instance services all the requests.

d) The servlet doGet( ) method has been marked as synchronized.
my answer - a)
5)
Most web applications require logic for validating form input and determining the next page to display.
Given long term maintenance and reuse objectives, what is the BEST design to implement this logic?
a) A JSP that both validates form input and determines the next page.

b) Validate form input in a JSP and determine the next page in a servlet.

c) Validate form input in a servlet and determine the next page in a JSP.

d) A servlet both validates form input and determines the next page
my answer - b)
4)
Which of the following statements accurately describe the J2EE architecture?

a) Web components provide presentation logic that works well with anonymous clients over the Internet.

b) EJBs provide business logic within the context of transactions and persistence.

c) Web components access EJBs through the same APIs as application clients.

d) Application servers provide the infrastructure for the J2EE architecture.

Multiple Select - Please select all of the correct answers.
my answer - a), b), d)
Thanks in advance
Ruilin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!