1)Can we use the annotation @PrePassivate for more than one method in a bean?
a)Yes
b)No
2)What should be the return type of the method using @PrePassivate?
a)Object
b)void
c)String
d)boolean
3)Which of the following are correct statements about @PrePassivate?
a)Method’s return value must not be void
b)Method cannot be private
c)The method must not be final.
d)The method must not throw a checked exception.
e)All of the above
4)Which of the following callbacks are called during the passivattion and activation process?
a)@PostConstruct
b)@PostActivation
c)@PrePassive
d)@PostActivate
5)Which of the following call backs are called for the stateful session bean?
a)construction
b)destruction
c)activation
d)passivation
e)All the above
6)Which of the following call backs are supported for the stateless session bean?
a)post construction
b)pre destroy
c)passivation
d)activation
e)All of the above
7)Which of the following statements are true about interceptors?
a)Interceptor can not invoke JMS
b)Interceptor class must have a public no-arg constructor.
c)Interceptor instance can not be created when the Bean instance is created.
d)Interceptor can invoke JNDI
8)Extended persistence context support is only for interceptors associated with stateful session beans.
a)False
b)True
9)Which of the following annotations are related to configuring the interceptors?
a)@AroundInvoke
b)@ExcludeClassInterceptors
c)@ExcludeDefaultInterceptors
d)@Interceptors
e)All of the above
10)Which of the following are the valid statements for @AroundInvoke?
a)AroundInvoke method cannot be a business method of the bean
b)AroundInvoke method can invoke any resource tha a business method can access
c)AroundInvoke method can be declared as final
d)AroundInvoke method cannot be static
SCBCD 5.0 Mock Questions Answers – 2
1)b)no
Only one method in the bean class can be annotated with @PrePassivate. If you annotate more than one method with this annotations, the EJB will not deploy.
2)b)void
The return type of the method must be void.
3)c,d
- The following are the restrictions for the @PrePassivate method:
- The return type of the method must be void.
- The method must not throw a checked exception.
- The method may be public, protected, package private or private.
- The method must not be static.
- The method must not be final.
- This annotation does not have any attributes.
4)c,d
5)e
6)a,b
7)B,D
8)b
9)e
10)a,b,d