250+ TOP MCQs on EJB 3.0 with Spring and Answers

Java Spring Multiple Choice Questions & Answers (MCQs) on “EJB 3.0 with Spring”.

1. Interceptor to let Spring configure @Autowired elements on your EJB.
a) org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor
b) org.springframework.ejb.interceptor.SpringBeanAutowiring
c) org.springframework.ejb.interceptor.SpringBean
d) none of the mentioned
Answer: a
Clarification: Use the org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor interceptor to let Spring configure @Autowired elements on your EJB.

2. A remote stateless session bean requires annotations:-
a) @Remote
b) @Stateless
c) All of the mentioned
d) None of the mentioned
Answer: c
Clarification: A remote stateless session bean requires the @Stateless and @Remote annotations. In the @Remote annotation, you have to specify the remote interface for this EJB component.

3. Proxying Spring services with EJB3s, injecting custom resources configured in Spring, or even using Spring to isolate your EJBs from acquiring references to other distributed resources such as a REST endpoint or an RMI endpoint.
a) SpringBeanAutowiringInterceptor
b) SpringBeanAutowiring
c) SpringBean
d) SpringBeanInterceptor
Answer: a
Clarification: To do this, use Spring’s SpringBeanAutowiringInterceptor class to provide configuration for the EJB.

4. Annotation which decorates the PostageServiceBean:-
a) @Interceptors
b) @Autowire
c) @Wire
d) @Mention
Answer: a
Clarification: This tells Spring to handle @Autowired injection points in the class.

5. The interceptor obtains beans, by default, from a ContextSingletonBeanFactoryLocation.
a) True
b) False
Answer: a
Clarification: The interceptor obtains beans, by default, from a ContextSingletonBeanFactoryLocation, which in turn looks for an XML application context named beanRefContext.xml, which is presumed to be on the classpath.

6. EJB interface is a simple Java interface whose methods don’t throw RemoteException.
a) True
b) False

Answer: a
Clarification: EJB interface is a simple Java interface whose methods don’t throw RemoteException, while the implementation class is a simple Java class annotated with EJB annotations.

7. To declare a JNDI object reference in the Spring IoC container.
a) JndiObjectFactory
b) JndiObjectFactoryBean
c) JndiObject
d) JndiFactoryBean
Answer: b
Clarification: By using Spring’s JndiObjectFactoryBean, you can easily declare a JNDI object reference in the Spring IoC container. You can use this factory bean to declare a reference to an EJB 3.0 component.

8. The default JNDI name for a remote EJB 3.0 component is the EJB class name with Remote as its suffix .
a) True
b) False
Answer: a
Clarification: If you have chosen OpenEJB as your EJB container, the default JNDI name for a remote EJB 3.0 component is the EJB class name with Remote as its suffix (PostageServiceBeanRemote, in this case).

9. You can configure the JNDI details for factory bean in:-
a) jndiEnvironment
b) jndiName
c) all of the mentioned
d) none of the mentioned
Answer: c
Clarification: You can configure the JNDI details for factory bean in the jndiEnvironment and jndiName properties.

10. Lightweight remoting technologies developed by Caucho Technology.
a) Hessian
b) Burlap
c) All of the mentioned
d) None of the mentioned
Answer: c
Clarification: Hessian and Burlap are two simple lightweight remoting technologies developed by Caucho Technology (http://www.caucho.com/).

11. Spring framework itself also offers a remoting technology called HTTP Invoker.
a) True
b) False
Answer: a
Clarification: It also communicates over HTTP, but uses Java’s object serialization mechanism to serialize objects.

  250+ TOP MCQs on ORM Frameworks and Answers

12. To expose a Hessian or Burlap service, you have to add the:-
a) Hessian library
b) Burlap library
c) All of the mentioned
d) None of the mentioned
Answer: c
Clarification: To expose a Hessian or Burlap service, you have to add the Hessian library to your classpath.

13. For a HessianServiceExporter instance, you have to configure a service object to export and its service interface.
a) True
b) False
Answer: a
Clarification: You can export any bean configured in the IoC container as a Hessian service, and HessianServiceExporter will create a proxy to wrap this bean.

14. By default, BeanNameUrlHandlerMapping is preconfigured for a Spring MVC application.
a) True
b) False
Answer: a
Clarification: It maps requests to handlers according to the URL patterns specified as bean names.

15. Invoking a Burlap service:-
a) HessianProxyFactoryBean
b) BurlapProxyFactoryBean
c) BurlapProxyFactory
d) BurlapProxy
Answer: b
Clarification: Invoking a Burlap service is very similar to Hessian. The only difference is that you should use BurlapProxyFactoryBean.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top