• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Five new mock questions for SCBCD beta

 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A little practice:
(Remember, this won't be an open-book test.)

1 Which two are guaranteed capabilities of EJB 2.0?
a). Local home interfaces for messages driven beans.
b). Dirty detection mechanisms to reduce memory footprints.
c). Run-as security identity functionality.
d). The JDBC 2.0 extension.
e). Read only CMP entity beans.
2 Which API is NOT guaranteed to be supported by EJB 2.0 containers?

a). JAXP
b). JNDI
c). JXTA
d). JDBC
e). JMS
3 When programming business methods, which technique should be avoided to ensure bean portability across all EJB 2.0 containers?
a). Using the java.net.Socket class.
b). Using inner classes.
c). Using the 'final' modifier for fields.
d). Passing 'this' as an argument.
4 Which two are typically responsible for creating ejb-jar files? (Choose two.)
a). The bean provider.
b). The application assembler.
c). The deployer.
d). The system administrator.
5 Which two must be included in every ejb-jar file? (Choose two.)
a). Stubs for the EJBHome and EJBObject interface.
b). The JAR Manifest file.
c). A deployment descriptor.
d). The JNDI context.
e). The EJB's home interface.
Good luck!
-Bert
p.s. They'll get tougher after this.
[ May 28, 2003: Message edited by: Bert Bates ]
[ May 28, 2003: Message edited by: Bert Bates ]
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bert Bates:
A little practice:
(Remember, this won't be an open-book test.)


Okay, answering from my memory then. May be incorrect, but at least I have an opinion.


1 Which two are guaranteed capabilities of EJB 2.0?
a). Local home interfaces for messages driven beans.


There is no need for local interfaces for MDBs as long as they are asynchronius.


b). Dirty detection mechanisms to reduce memory footprints.


This one is a correct answer No. 1


c). Run-as security identity functionality.


Correct answer No. 2


d). The JDBC 2.0 extension.


No, JDBC 2.0 is a standard spec and should not be extended by anyone.


e). Read only CMP entity beans.


It's not part of a spec, however, few containers allow you to do read-only CMPs.


2 Which API is NOT guaranteed to be supported by EJB 2.0 containers?

a). JAXP
b). JNDI
c). JXTA
d). JDBC
e). JMS


JXTA is not guaranteed. However, you should make clear distinction between EJB 2.0 containers and J2EE 1.3 containers. By the way, JDBC is not a part of J2EE as well, it's part of J2SE.


3 When programming business methods, which technique should be avoided to ensure bean portability across all EJB 2.0 containers?
a). Using the java.net.Socket class.
b). Using inner classes.
c). Using the 'final' modifier for fields.
d). Passing 'this' as an argument.


d) - one should reference bean context instead.


4 Which two are typically responsible for creating ejb-jar files? (Choose two.)
a). The bean provider.
b). The application assembler.
c). The deployer.
d). The system administrator.


b) and c) as far as I remember


5 Which two must be included in every ejb-jar file? (Choose two.)
a). Stubs for the EJBHome and EJBObject interface.
b). The JAR Manifest file.
c). A deployment descriptor.
d). The JNDI context.
e). The EJB's home interface.



c) and e) (if under EJB's home interface you mean a tag that allows you to specify it).
Alex
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alex, privet! It's been quite some time since you last posted on JR! Nice to see you again!
Dear Bert and all, please correct my answers if they are not right.
1 Which two are guaranteed capabilities of EJB 2.0?
a). Local home interfaces for messages driven beans.
b). Dirty detection mechanisms to reduce memory footprints.
c). Run-as security identity functionality.
d). The JDBC 2.0 extension.
e). Read only CMP entity beans.
-- ANSWERS: C
-- No Local and remote (home) interfaces for messages driven beans
-- According to specs some custom application should periodically run to do dirty detection mechanisms to reduce memory footprints
-- no reference to JDBC 2.0 extension
-- Bean Provider is responsible for Read only CMP entity beans
2 Which API is NOT guaranteed to be supported by EJB 2.0 containers?
a). JAXP
b). JNDI
c). JXTA
d). JDBC
e). JMS
-- ANSWERS: C
-- JXTA is the only one that is NOT guaranteed by the specs.
3 When programming business methods, which technique should be avoided to ensure bean portability across all EJB 2.0 containers?
a). Using the java.net.Socket class.
b). Using inner classes.
c). Using the 'final' modifier for fields.
d). Passing 'this' as an argument.
-- ANSWERS: A and D
-- To my knowledge only Socket and passing "this" are warned by the specs.
4 Which two are typically responsible for creating ejb-jar files? (Choose two.)
a). The bean provider.
b). The application assembler.
c). The deployer.
d). The system administrator.
-- ANSWERS: A
-- Bean provider writes the DD and "advises" some settings to the Deployer. (Specifically about MDBs Destination)
5 Which two must be included in every ejb-jar file? (Choose two.)
a). Stubs for the EJBHome and EJBObject interface.
b). The JAR Manifest file.
c). A deployment descriptor.
d). The JNDI context.
e). The EJB's home interface.
-- ANSWERS: C and E
-- ejb-jar file provided by the Bean Provider must contain -->Remote and/or Local + home interfaces + Bean Class + DD
[ May 28, 2003: Message edited by: Seid Myadiyev ]
[ May 28, 2003: Message edited by: Seid Myadiyev ]
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.net.Socket can be used in an EJB but not ServerSocket.
Answer for 4 is a and b.
Q # 5
What if the EJB is MDB?
There will be no home interface, there will be only DD.
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I meant to type A and C for Question 4.
4 Which two are typically responsible for creating ejb-jar files? (Choose two.)
a). The bean provider.
b). The application assembler.
c). The deployer.
d). The system administrator.
-- ANSWERS: A and C
-- Bean provider writes the DD and "advises" some settings to the Deployer: (so A and C).
+Seid
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont think that Deployer is responsible for creating DD.
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


1 Which two are guaranteed capabilities of EJB 2.0?
a). Local home interfaces for messages driven beans.
b). Dirty detection mechanisms to reduce memory footprints.
c). Run-as security identity functionality.
d). The JDBC 2.0 extension.
e). Read only CMP entity beans.


Answer: C and D
C - <run-as> tag is a part of a spec for specifying a fixed role for bean security Principal. one can use it when she wants all methods of a bean to run as some identity. if there were a security context propagated from the client, it's ignored, and the <run-as> identity would be used instead.
D - DataSource interface is heavily utilised in today's J2EE applications. It's part of jdbc extensions package.
A - MDB cannot have client view. The only way to reach it is only by sending it a message through JMS (this was extended in EJB 2.1, but ignore the fact for the sake of exam).
B, E - container optimisations, which are not prescribed for implementing by containers and which are set-up in a vendor-specific way.


2 Which API is NOT guaranteed to be supported by EJB 2.0 containers?
a). JAXP
b). JNDI
c). JXTA
d). JDBC
e). JMS


Well, JXTA, as was stated above. Though in our networked society it is possible to be considered later. soon. but not too soon.


3 When programming business methods, which technique should be avoided to ensure bean portability across all EJB 2.0 containers?
a). Using the java.net.Socket class.
b). Using inner classes.
c). Using the 'final' modifier for fields.
d). Passing 'this' as an argument.


Answer: D
One should use getEJBObject/getEJBLocalObject methods of corresponding XXXContext interface.
A - using Socket is ok, unless you use a ServerSocket.
B, C - these are valid Java constructs that have no restrictions for EJB.


4 Which two are typically responsible for creating ejb-jar files? (Choose two.)
a). The bean provider.
b). The application assembler.
c). The deployer.
d). The system administrator.


Well, I'd like Bert to give some insight on 'ejb-jar' files. Are these 'ejb-jar.xml' or xxx.jar archives with ejbs and everything in them?
This answer assumes ejb-jar.xml was meant.
Answer: A, B
A - the bean provider writes the code of the class and puts the resources (as they were referenced) in the descriptor
B - the application assembler links the references (if required), provides transaction attributes and method permissions in the ejb-jar.xml
C - the deployer maps the resources wanted by the jar to the existing environment (creates JDBC datasources, maps security roles to enterpise infrastructure, e.g. LDAP, etc.)
D - the system administrator ensures the runtime well-being of the system.


5 Which two must be included in every ejb-jar file? (Choose two.)
a). Stubs for the EJBHome and EJBObject interface.
b). The JAR Manifest file.
c). A deployment descriptor.
d). The JNDI context.
e). The EJB's home interface.



Well, again, confused about 'ejb-jar'. XML or archive???
This time let's assume it's a JAR file.
Answer: B, C
B - is included in any JAR file, it's a standard.
C - is a requirement for EJB archives. it is put into /META-INF dir of the jar alonside MANIFEST.MF file.
A - stubs are container generated utility low-level classes. Note, that, not even all EJB containers require them to be in the jar. E.g, in RI server you had to 'deploy' it through util. In WebLogic you use EJBC compiler to accomplish the task. JBoss doesn't need it, as it generates them on the fly when you deploy (copy) the jar to the server dir. The purpose of those stubs is to communicate through the network, implement container security callbacks, etc.
D - well, if someone tells me how to include the JNDI context... What you could do, is put a jndi.properties file in the jar where you describe the JNDI provider classes and where to reach the InitialContext. And this is not technically 'JNDI context inclusion'.
E - providing EJBHome interface alone is not enough. Do we still remember it?

My $.02 deposit. If Bert ever reads this topic again, please elaborate on the confusing points, please.
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But does Deployer modify the DD?
Thanks!
+Seid
EJB 2.0 Specs.
15.4.9 Association of a message-driven bean with a destination
A message-driven bean is associated with a JMS Destination (Queue or Topic) when the bean is
deployed in the container. It is the responsibility of the Deployer to associate the message-driven bean
with a Queue or Topic.
The Deployer should avoid associating more than one message-driven bean with the same JMS Queue.
If there are multiple JMS consumers for a queue, JMS does not define how messages are distribued
between the queue receivers.
The Bean Provider may provide advice to the Deployer as to whether a message-driven bean is intended
to be associated with a queue or a topic by using the message-driven-destination deployment
descriptor element.
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Pradeep and Andrew, your replies help!
+Seid
 
Andrew Perepelytsya
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seid, I understand your confusion.
The deployer does not modify the 'ejb-jar.xml' file. But she does modify vendor descriptors.
About MDB. When you write the bean code, you do not assume any name for the Queue/Topic to be listening to. The hint they talk about is like this:

<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>
you could also put javax.jms.Topic instead of the Queue - it all depends on the requirements. Please note, that there's no notion of the actual name of the queue/topic. This is a responsibility of the Deployer.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andrew Perepelytsya:

B, C - these are valid Java constructs that have no restrictions for EJB.



Not Quite, 7.10.4 in the spec: "The method must not be declared as final or static.". The reason is that the container should be able to extend your class (to generate the code for a security, transaction, activation etc. handling). I suppose that EJBs with final business methods would work in jboss since they do not generate a class extending your bean, instead of that they use proxys.
Dragan
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrew, thank you very much for your clarification! It cleared the point.
I also would like to say that I find all your post very helpful!
Thank you very much again!
+Seid
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dragan,
This option states:
"Using the 'final' modifier for fields."
-- for fields -- I took it literally.
+Seid
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no mention of method in the question but fields.

Originally posted by Dragan Milic:


Not Quite, 7.10.4 in the spec: "The method must not be declared as final or static.". The reason is that the container should be able to extend your class (to generate the code for a security, transaction, activation etc. handling). I suppose that EJBs with final business methods would work in jboss since they do not generate a class extending your bean, instead of that they use proxys.
Dragan

 
Dragan Milic
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Seid Myadiyev:
Hi Dragan,
This option states:
"Using the 'final' modifier for fields."
-- for fields -- I took it literally.
+Seid



Oops, sorry ... i didn't read carefully.
Dragan
 
Alex Pisarev
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<QB><QUOTE>
Andrew Perepelitsa wrote:
D - DataSource interface is heavily utilised in today's J2EE applications. It's part of jdbc extensions package.
</QB></QUOTE>
But does it mean that it's guaranteed capability of EJB 2.0 spec (EJB 2.0 spec !=J2EE 1.3 spec)? I will kindly disagree.
<QB><QUOTE>
B, E - container optimisations, which are not prescribed for implementing by containers and which are set-up in a vendor-specific way.
</QB></QUOTE>
Concerning B. May be I am wrong, but as far as I remember (don't have spec on this machine to look it up), the containers are required to process transactions in a three different ways (A, B and C - Jboss has D). So, when we have the case with shared databases (was it case B?), cache should be updated with every transaction and the containers are advised to provide optimal methods to detect which parts of cache to update. However, may be I am misleaded somehow, but in that case the question will have only one right answer.
 
Andrew Perepelytsya
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JDBC extensions (of which DataSource is, perhaps, the most renowned) was a must since EJB 1.1. Please, consult the specification, section C.2.5, page 542.


b). Dirty detection mechanisms to reduce memory footprints.


I think the way it is stated in the answers (never 'add' anything from yourself on the exam, you know it), involves a bit more than just dirty reads problem. While the behaviour you described may be compulsory, it tells us about transactional behaviour, and not memory management improvements (optional).
[ May 28, 2003: Message edited by: Andrew Perepelytsya ]
 
Alex Pisarev
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andrew Perepelytsya:
JDBC extensions (of which DataSource is, perhaps, the most renowned) was a must since EJB 1.1. Please, consult the specification, section C.2.5, page 542.


Okay, I trust your words, just because I don't remember the spec by heart (last time I opened it was half a year ago or so) and don't have access to spec from this machine to look it up.


I think the way it is stated in the answers (never 'add' anything from yourself on the exam, you know it), involves a bit more than just dirty reads problem. While the behaviour you described may be compulsory, it tells us about transactional behaviour, and not memory management improvements (optional).


Well, in that case you're right with both answers. If JDBC extensions didn't mislead me at the beginning, I'd had rejected this answer as I initially wanted to.
Another point to testify that it will be better for myself to read the spec once more before taking an exam.
 
Bert Bates
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow!
OK - I think you guys are narrowing in on the correct answers...
I'm working on a new batch now, answers for this batch tomorrow.
Remember, when Kathy or Kimberly or I post these mock questions we're trying to make them feel as close as possible to the real questions you'll encounter. While we DO make mistakes, read the questions carefully, subtle wording can make a right answer seem wrong, or a wrong answer seem right.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andrew Perepelytsya:
[QB]
Well, again, confused about 'ejb-jar'. XML or archive???
This time let's assume it's a JAR file.
QB]


Remember, the term "ejb-jar" is the official name, in the spec, for the Bean Developer's 'deliverable'. So it has a very specific meaning in the spec, even though it IS a JAR file format, it has specific requirements that make it an ejb-jar. Those requirements are on the exam, and they involve knowing what IS and what is NOT supposed to be in the ejb-jar.
Not that you're supposed to be looking in the spec yet... but there is an entire (albeit small) chapter with that name: "EJB-jar file" (23). So when you see ejb-jar (or EJB-jar) that is different from the generic use of the term ejb JAR. In other words, the dash (-) between ejb and jar (ejb-jar) matters!
cheers,
Kathy
 
Bert Bates
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answers for this set of mock questions, you guys did great! This is mostly just confirmation:

#1, answers are: c, d
Perhaps answer b should be elaborated: In the EJB 2.0 spec, pages 25 and 26: "The new container-mananged persistance mechanisms are added to provide the following functionality:
- To support more efficient vendor implementations leveraging lazy loading and dirty detection mechanisms; to reduce memory footprints; to avoid data aliasing problems... "
#2 answer: c
#3 answer: d
#4 answers: a, b.
From the EJB 2.0 spec, chapters 3 and 22
#5 answers: c, e
As of 2.0 the JAR Manifest file is not required. (spec 23.7.1)
Next batch, for objective 2 and maybe 3, out tomorrow,
thanks for giving these babies a workout!
-Bert
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bert
I dont agree that e is also the answer of question # 5. If I create an ejb-jar file containing <bold>only MDB </Bold>then from where do I get the home interface?
 
Andrew Perepelytsya
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same comment. If we put only MDBs in ejb-jar there won't be any home interfaces. I guess it's time to give feedback now, not on the exam (if you ever take the beta).
Bert?
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where in the spec does it give the answer for # 2?
I was torn between a and c mostly because I forgot what those two APIs do but I do not remember reading anything about in the EJB 2.0 spec.
Jehan
 
Bert Bates
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pradeep and Andrew -
You're right! My bad, sorry. What if question #5 said:
Which two must be included in every session bean's ejb-jar file?
(One of the ideas tested by this question is whether you understand that the JAR manifest file is no longer needed in EJB 2.0)
Jehan -
Look in section 24.1.1 for a list of guaranteed APIs.
Next batch of Q's will be posted shortly!
-Bert
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic