File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes SCBCD Mock Q's - Batch 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 "SCBCD Mock Q Watch "SCBCD Mock Q New topic
Author

SCBCD Mock Q's - Batch 2

Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
Some more fodder for the beta studiers
Remember: It's not an open book test!
IMPORTANT NOTE: I cheated a little by saying 'choose all that apply'. On the real exam you will ALWAYS be told how many answers are correct, I just wanted to toughen it up a little
1 Which statement about session beans is true?
a). The bean provider must write the method public void remove() in both stateless and stateful session classes.
b). Local clients can remove session beans by calling a method on the bean's home.
c). The ejbRemove() method in the component interface can be used only by remote clients.
d). To ask the EJBHome to remove a session bean, the client must provide the bean's handle.

2 Which statement about locating or using a session bean's home interface is true?
a). Acquiring an 'InitialContext' is required only for remote clients.
b). The 'InitialContext' must be narrowed before it can be used.
c). Once acquired by a client, a home interface can be used multiple times.
d). The client can acquire a handle for the bean's local home interface.

3 When comparing two session objects, what is true? (Choose all that apply.)
a). Using the 'isIdentical' method, stateless session beans from the same home will always return true.
b). Using the 'isIdentical' method, stateful session beans from the same home will always return true.
c). The 'isIdentical' method can be used only for remote object references.
d). Using the 'equals' method, stateless session beans from the same home will always return true.
e). Using the 'equals' method, stateful session beans from the same home will always return true.

4 Which method can be called by both remote and local clients on a reference to a session bean's component interface?
a). ejbCreate
b). getSessionContext
c). getPrimaryKey
d). getEJBHome
e). remove


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Hung Tang
Ranch Hand

Joined: Feb 14, 2002
Posts: 148
My answers are:
1. b
2. (assuming referring to remote home interface)
b,c
3. a
4. c,e
Hung Tang
Ranch Hand

Joined: Feb 14, 2002
Posts: 148

4. c,e

change answer to
4. c,d,e
Dennis Shi
Greenhorn

Joined: Mar 22, 2003
Posts: 17
My answers:
1. d
2. c
3. a
4. e
sh yh
Greenhorn

Joined: Aug 14, 2002
Posts: 21
Originally posted by Dennis Shi:
My answers:
1. d
2. c
3. a
4. e

I agree with Dennis' answers except for the 4th question. My answer for it is (C and E) because getPrimaryKey() can be called by both remote and local objects even though exceptions will be thrown.
Matthew Anderson
Ranch Hand

Joined: Apr 18, 2003
Posts: 33
1 Which statement about session beans is true?
a). The bean provider must write the method public void remove() in both stateless and stateful session classes.
False. Usually implemented by container.
b). Local clients can remove session beans by calling a method on the bean's home.
False. To remove beans via home, can use either remove(Handle handle) or remove(Object PK). However local clients cannot get handles, therefore remove(Handle handle)is out. Remove(Object PK) can only be used by entity beans since session beans do not have PK.
c). The ejbRemove() method in the component interface can be used only by remote clients.
False. ejbRemove() is defined in session bean class and not in component interface.
d). To ask the EJBHome to remove a session bean, the client must provide the bean's handle.
True. Explanation in b). remove(Handle handle) is applicable to remote home.


SCJP 1.2, SCWCD, SCJD
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Only entity beans have primary keys. So c is not a correct choice.

Originally posted by sh yh:

I agree with Dennis' answers except for the 4th question. My answer for it is (C and E) because getPrimaryKey() can be called by both remote and local objects even though exceptions will be thrown.


Groovy
sh yh
Greenhorn

Joined: Aug 14, 2002
Posts: 21
Originally posted by Pradeep Bhat:
Only entity beans have primary keys. So c is not a correct choice.


Yes, only entity beans have primary keys, but C is still a correct choice. Because you CAN still call the method getPrimaryKey even though it doesn't have a primary key. Remember, the question asked whethere or not you "CAN" call the method, the question didn't ask you if there is a primary key.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

I agree with you
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
I think the question should be reworded, how about:
Which method can be called without exception, by both...
- or -
Which method can be successfully called, by both...

I guess I prefer the first alternate, any thoughts?
-Bert
Forrest Xu
Ranch Hand

Joined: Nov 16, 2002
Posts: 92
component interface means remote component interface. So I think d) is also right answer!
Forrest Xu
Ranch Hand

Joined: Nov 16, 2002
Posts: 92
4 Which method can be called by both remote and local clients on a reference to a session bean's component interface?
a). ejbCreate
b). getSessionContext
c). getPrimaryKey
d). getEJBHome
e). remove
Sorry I think It should be D,E, since component interface is remote component interface which can be used for by local or remote client.(Normally we define remote component interface as component interface and local component interface as local component interface).local client means the same VMS with the session bean. Remote component interface can be called by local bean client but not vice versa. So d) is OK!
Ming Jiang
Greenhorn

Joined: Apr 07, 2003
Posts: 2
My answers:
1. d
2. c
3. a
4. c d e
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SCBCD Mock Q's - Batch 2