aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Mock exam questions on MDB  (2) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Mock exam questions on MDB  (2)" Watch "Mock exam questions on MDB  (2)" New topic
Author

Mock exam questions on MDB (2)

Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
OK, a couple of easy ones
==========================
Which two are true about message-driven beans? (Choose two.)
A) Message-driven beans do not expose a client view.
B) Message-driven beans must implement the JMSListener interface.
C) Message-driven beans cannot throw application exceptions.
D) Message-driven beans must not use bean-managed transaction demarcation.
E) Message-driven beans can use the getCallerPrincipal() method of MessageDrivenContext.
====================================
Which transaction attributes can be specified for a message-driven bean? (Check all that apply, from none to all)
A) Required
B) RequiresNew
C) Supports
D) NotSupported
E) Mandatory
F) Never
[Don't freak out over the 'check all that apply' thing. The real exam DOES tell you how many to choose. But I have to make it a little harder here so that you'll think about it more... ]
cheers,
Kathy

"Nothing is too wonderful to be true..."
-Michael Faraday
Seid Myadiyev
Ranch Hand

Joined: Jul 02, 2002
Posts: 196
Which two are true about message-driven beans? (Choose two.)
A) Message-driven beans do not expose a client view.
B) Message-driven beans must implement the JMSListener interface.
C) Message-driven beans cannot throw application exceptions.
D) Message-driven beans must not use bean-managed transaction demarcation.
E) Message-driven beans can use the getCallerPrincipal() method of MessageDrivenContext.

Dear Kathy,
To my knowledge the correct answers are: A and C!
A) True: because MDB is not intended to be accessible to the client and has no APIs for client.
B) MDB must implement the javax.ejb.MessageListener and MessageDrivenBean interfaces and not a JMSListener.
C) True: No application exceptions should be thrown from onMessage() method of MDB.
Only container can throw system exceptions from MDB methods.
D) IllegalStateException will be thrown by the container if this method is called because MBD
methods are called by the container and do not run in a security context.
Please correct me if I am wrong!
Thank you!
Seid
Seid Myadiyev
Ranch Hand

Joined: Jul 02, 2002
Posts: 196
Which transaction attributes can be specified for a message-driven bean? (Check all that apply, from none to all)
A) Required
B) RequiresNew
C) Supports
D) NotSupported
E) Mandatory
F) Never
In this questions only A and B are correct answers!
Please correct me if I am wrong.
Thanks,
Seid
Dragan Milic
Ranch Hand

Joined: Oct 03, 2002
Posts: 31
Originally posted by Kathy Sierra:
Which transaction attributes can be specified for a message-driven bean? (Check all that apply, from none to all)
A) Required
B) RequiresNew
C) Supports
D) NotSupported
E) Mandatory
F) Never

AFAIK A and D are the correct Answers
Dragan
Andrew Perepelytsya
Ranch Hand

Joined: Aug 21, 2002
Posts: 93
True, Dragan, A and D are the answers.
B) RequiresNew
Does not make sense as the transaction context is not propagated from the client (there's no client view at all), so no previous transaction to suspend by this attribute value.
C) Supports
When we state this attribute, the caller's transaction context will determine the behaviour. We will either run w/o a transaction (if the caller didn't have one) or join a transaction (if the caller had one). For the reasons stated above, this is always equal to NotSupported TX attribute in case of MDB.
E) Mandatory
Again, no client view, no client transaction presence to check and enforce.
F) Never
For merely the same reason as in E.
P.S.: I really find it a fruitful learning to not only choose the right answer, but explain why you didn't choose the others as well. Is it of any help to you, ranchers?
Seid Myadiyev
Ranch Hand

Joined: Jul 02, 2002
Posts: 196
Andrew, you are right about explanations!
I took time to explain my answers to the first question but not to the second one.
(To my embarrassment I meant "Required" and "NotSupported" but I mistakenly chose B instead of D. Had I taken time to justify my choices my mistake would have been evident in addition to explanations to readers. Sorry about that.)

Thank you very much for the advice and corrections, Dragan and Andrew!
+Seid
[ May 23, 2003: Message edited by: Seid Myadiyev ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Mock exam questions on MDB (2)