This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Mastering Corda: Blockchain for Java Developers and have Jamiel Sheikh on-line!
See this thread for details.
Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

SCBCD Mock Questions, batch #3

 
author
Posts: 9005
20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More fodder, with new and enhanced disclaimers:
Disclaimers:
You WON'T get any questions on the real exam that say 'choose all that apply' - you will always know exactly how many answers are correct. I use 'choose all that apply' to make these questions harder, you know, to toughen you up a bit
When I say 'choose all that apply', there will ALWAYS be at least one correct answer.
The real exam uses several forms of 'drag and drop' which I'm kind of pseudo-emulating here; read the questions carefully, for instance some are one-to-many, some are not!
Finally, remember the real exam is NOT open-book
End of disclaimers, and on to the questions:

1. Which are directly invoked by the client? (Choose all that apply.)
a). ejbPassivate
b). business methods
c). setSessionContext
d). newInstance
e). create

2. Which is true about passivation for stateful session beans? (Choose all that apply.)
a). The container can passivate a stateful session bean regardless of the bean's state.
b). The client can passivate a session bean.
c). References to JNDI contexts are lost during passivation.
d). References to 'SessionContext' are preserved during passivation.
e). A passivated, stateful session bean instance will always be re-activated prior to removal.

3. (Note: The real exam has several types of 'drag and drop' questions, that I'm going to do a lame job of simulating with this question...)
Match the methods on the left with the interfaces in which those methods can be found, on the right. A match is correct if the method is either declared in, or inherited by, the interface. Note: There may be some many-to-one and one-to-many relationships in your answer.

4. Which statements about stateful and stateless session beans are true?
(Choose all that apply.)
a). Only stateful session beans support transactions.
b). Only stateful session beans can be passivated.
c). Only stateful session beans have a 'setSessionContext' method.
d). Both stateful and stateless session beans can support overloaded 'ejbCreate' methods.
e). Both stateful and stateless session beans can implement the 'javax.ejb.SessionSynchronization' interface.
f). Both stateful and stateless session beans can have instance variable state.

5. Which statements about a session bean class are true? (Choose all that apply.)
a). They can be marked 'final'
b). They can support overloaded constructors.
c). Their business methods can be 'private'.
d). Their business method names must start with "ejb".
e). Their 'ejbCreate' methods must not be declared as 'final'.

6. For this drag and drop type question, you can use each element only once. Which interface should be matched with which fact, so that all four matches are correct?

Have Fun !
-Bert
[ May 30, 2003: Message edited by: Bert Bates ]
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. b,e
2. c,d
3.
SessionSynchonization -> afterCompletion, afterBegin
SessionContext -> isCallerInRole, getRoleBackOnly, getUserTransaction
Sessionbean -> setSessionContext
UserTransaction -> ??? =)
4. a, b, f
5.
1 -> b
2 -> d
3 -> a
4 -> c

ill be happy to get 3/6 =)
 
Hung Tang
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


5.
1 -> b
2 -> d
3 -> a
4 -> c


Oops, mistake:
5. e
6.
1 -> b
2 -> d
3 -> a
4 -> c
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My answers:
1. b, e
2. d
3. a) --> 1)
b) --> 2)
c) --> 1)
d) --> 2)
e) --> 2)
f) --> 3)
4. b, f
5. e
6. 1) --> b)
2) --> d)
3) --> c)
4) --> a)
dennis
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Regarding constructors, I understand that there is nothing wrong in having overloded constrcutors as long as there is a no args constructor.
Good work,Dennis Shi .
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1 b e
2 d
3 a 1
b 2
c 1
d 2
e 2
f 3
4 b f
5 e
6 1 b
2 d
3 c
4 a
agree completely with dennis
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I don't seem to agree with the answer for question 4. Shouldn't it be b,f.
A statless Session Bean can have instance variable state - albeit just across the single method call. There is nothing in the spec that says otherwise. I know it dosen't make much sense to have instance vraiables in Statless session beans, but technically that is possible.
Anyone agree with me ?
 
Sundeep Dhillon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Akasmat,
agree with u completely which is why i have gone for b and f for question 4
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My Answers:
1. b,e
2. d,e
3.
a). afterCompletion ----------> SessionSynchronization
b). getUserTransaction----------> SessionContext
c). afterBegin ---------> SessionSynchronization
d). isCallerInRole----------> SessionContext
e). getRollBackOnly ----------> SessionContext
f). setSessionContext ----------> SessionBean

4. b,f
5. e

6.
1) remote component----->b. extends 'javax.ejb.EJBObject'
2) remote home--->d.can be used to retrieve an EJBObject reference.
3) local component--->c. methods must NOT throw 'java.rmi.RemoteException'
4) local home--------->a. does not have a getHomeHandle() method

-Rishi
 
Straws are for suckers. Now suck on this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic