Explore topic-wise MCQs in Java Spring Framework.

This section includes 104 Mcqs, each offering curated multiple-choice questions to sharpen your Java Spring Framework knowledge and support exam preparation. Choose a topic below to get started.

1.

You can create a dom4j endpoint by extending the:-

A. AbstractDom4jPayloadEndpoint
B. AbstractDom4jPayload
C. AbstractDom4jEndpoint
D. None of the mentioned
Answer» B. AbstractDom4jPayload
2.

For two transactions T1 and T2, T1 reads some rows from a table and then T2 inserts new rows into the table.

A. Dirty Read
B. Nonrepeatable read
C. Phantom read
D. Lost Updates
Answer» D. Lost Updates
3.

Endpoint Classes for SAX:-

A. AbstractDomPayloadEndpoint
B. AbstractSaxPayloadEndpoint
C. AbstractDom4jPayloadEndpoint
D. AbstractXomPayloadEndpoint
Answer» C. AbstractDom4jPayloadEndpoint
4.

Spring EJB Support Classes for Different Types of EJB:-

A. AbstractStatelessSessionBean
B. AbstractStatefulSessionBean
C. AbstractMessageDrivenBean
D. All of the mentioned
Answer» E.
5.

Spring-WS provides various abstract endpoint classes for you to process the request.

A. org.springframework.ws.server.endpoint
B. org.springframework.ws.server
C. org.springframework.*
D. none of the mentioned
Answer» B. org.springframework.ws.server
6.

Spring provides a factory that can export beans annotated with:-

A. javax.jws.WebService
B. javax.jws.WebServiceProvider
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
7.

Web services can be invoked through the core template class:-

A. org.springframework.ws.client.core.WebServiceTemplate
B. JDBC Template
C. All of the mentioned
D. None of the mentioned
Answer» B. JDBC Template
8.

If you are using the JAX-RS Reference Implementation, this intermediary step will involve a tool called wsgen.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
9.

The current method should not run within a transaction. If there’s an existing transaction in progress, an exception will be thrown.

A. Required
B. MANDATORY
C. SUPPORTS
D. NEVER
Answer» E.
10.

For two transactions T1 and T2, T1 reads a field that has been updated by T2 but not yet committed.

A. Dirty Read
B. Nonrepeatable read
C. Phantom read
D. Lost Updates
Answer» B. Nonrepeatable read
11.

If there’s an existing transaction in progress, the current method should run within this transaction.

A. Required
B. REQUIRES NEW
C. SUPPORTS
D. NOT SUPPORTED
Answer» B. REQUIRES NEW
12.

Endpoint Classes for DOM:-

A. AbstractDomPayloadEndpoint
B. AbstractJDomPayloadEndpoint
C. AbstractDom4jPayloadEndpoint
D. AbstractXomPayloadEndpoint
Answer» B. AbstractJDomPayloadEndpoint
13.

If there’s an existing transaction in progress, the current method should run within the nested transaction.

A. Required
B. MANDATORY
C. NESTED
D. NEVER
Answer» D. NEVER
14.

Castor requires a mapping configuration file to know how to map objects to and from XML documents.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
15.

For some marshalling APIs, the object model must be generated by them so that they can insert marshalling-specific information.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
16.

A marshalling endpoint requires:-

A. marshaller
B. unmarshaller
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
17.

Endpoint Classes for Streaming StAX :-

A. AbstractDomPayloadEndpoint
B. AbstractSaxPayloadEndpoint
C. AbstractStaxStreamPayloadEndpoint
D. AbstractStaxEventPayloadEndpoint
Answer» D. AbstractStaxEventPayloadEndpoint
18.

OpenEJB 3.1.1 supports:-

A. EJB 2.x components
B. EJB 3.0 and EJB 3.1 components
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
19.

Endpoint Classes for dom4j:-

A. AbstractDomPayloadEndpoint
B. AbstractJDomPayloadEndpoint
C. AbstractDom4jPayloadEndpoint
D. AbstractXomPayloadEndpoint
Answer» D. AbstractXomPayloadEndpoint
20.

The Spring support classes facilitate building session beans:-

A. stateful session beans (SFSBs)
B. stateless session beans (SLSBs)
C. message-driven beans (MDBs)
D. all of the mentioned
Answer» E.
21.

Marshaller for JAXB 2.0:-

A. org.springframework.oxm.jaxb.Jaxb1Marshaller
B. org.springframework.oxm.jaxb.Jaxb2Marshaller
C. org.springframework.oxm.castor.CastorMarshall
D. org.springframework.oxm.xmlbeans.XmlBeansMarshaller
Answer» C. org.springframework.oxm.castor.CastorMarshall
22.

To send objects across the wire, beans need to be encoded using the Java Architecture for XML Binding (JAXB).

A. True
B. False
C. May be
D. Can't say
Answer» B. False
23.

Endpoint Classes for XML marshalling :-

A. AbstractDomPayloadEndpoint
B. AbstractSaxPayloadEndpoint
C. AbstractStaxStreamPayloadEndpoint
D. AbstractMarshallingPayloadEndpoint
Answer» E.
24.

The concept of an endpoint in web services is much like that of a controller in web applications.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
25.

Spring-WS supports using XML marshalling technology to marshal and unmarshal objects to and from XML documents.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
26.

Spring framework itself also offers a remoting technology called HTTP Invoker.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
27.

EJB interface is a simple Java interface whose methods don’t throw RemoteException.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
28.

If you want to expose EJB component for local access within an enterprise application, the preceding two interfaces should extend EJBLocalObject and EJBLocalHome.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
29.

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» D. none of the mentioned
30.

WebServiceTemplate provides a sendSourceAndReceiveToResult() method that accepts arguments:-

A. java.xml.transform.Source
B. java.xml.transform.Result
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
31.

In this method, you can access the request XML element, whose type is org.dom4j.Element, and the response document, whose type is org.dom4j.Document, as method arguments.

A. invoke
B. invokeInterval
C. invokeInternal
D. none of the mentioned
Answer» D. none of the mentioned
32.

For two transactions T1 and T2, T1 reads a field and then T2 updates the field.

A. Dirty Read
B. Nonrepeatable read
C. Phantom read
D. Lost Updates
Answer» C. Phantom read
33.

Tomcat doesn’t support JAX-WS by itself.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
34.

In some cases, it’s also hard to map an object to XML (e.g., an object graph with cyclic references) because there’s actually an impedance mismatch between an object model and an XML model.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
35.

Spring-WS supports various XML marshalling APIs.

A. Castor
B. JAXB 1.0
C. XMLBeans
D. All of the mentioned
Answer» E.
36.

If there’s an existing transaction in progress, the current method can run within this transaction.

A. Required
B. REQUIRES NEW
C. SUPPORTS
D. NOT SUPPORTED
Answer» D. NOT SUPPORTED
37.

Lightweight remoting technologies developed by Caucho Technology.

A. Hessian
B. Burlap
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
38.

If you need to get access to the entire SOAP message, you should write an endpoint class by implementing:-

A. org.springframework.ws.server.endpoint.MessageEndpoint
B. org.springframework.ws
C. org.springframework.ws.server.endpoint
D. all of the mentioned
Answer» B. org.springframework.ws
39.

Spring’s transaction support offers a set of technology-independent facilities, including transaction managers.

A. org.springframework.transaction.PlatformTransactionManager
B. org.springframework.transaction.support.TransactionTemplate
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
40.

Spring’s core transaction management abstraction is based on the interface:-

A. PlatformTransaction
B. PlatformTransactionManager
C. TransactionManager
D. PlatformManager
Answer» C. TransactionManager
41.

To use the context injection approach, you can declare an entity manager field in your DAO and annotate it with the @PersistenceContext annotation.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
42.

JpaTemplate will translate the native JPA exceptions into exceptions in Spring DataAccessException hierarchy.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
43.

Spring provides to simplify your DAO implementation by managing entitymanagers and transactions for you:-

A. HibernateTemplate
B. JpaTemplate
C. SpringTemplate
D. None of the mentioned
Answer» C. SpringTemplate
44.

HibernateTemplate will translate the native Hibernate exceptions into exceptions in Spring DataAccessException hierarchy.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
45.

DAO methods require access to the session factory, which can be injected:-

A. a setter method
B. constructor argument
C. none of the mentioned
D. all of the mentioned
Answer» E.
46.

Annotation for Hibernate exceptions to be translated into Spring DataAccessException for consistent exception handling:-

A. @Translation
B. @Repo
C. @Repository
D. None of the mentioned
Answer» D. None of the mentioned
47.

DAO methods must be made transactional.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
48.

You can assign a component name in this annotation and have the session factory autowired by the Spring IoC container with @Autowired.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
49.

An alternative to Spring HibernateTemplate is:-

A. HibernateContext
B. Hibernate contextual sessions
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
50.

Sessionfactory can manage contextual sessions for you and allows you to retrieve them by the:-

A. getSession() method
B. getCurrent() method
C. getCurrentSession() method
D. none of the mentioned
Answer» D. none of the mentioned