Explore topic-wise MCQs in Java Spring Framework.

This section includes 89 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.

The RetryTemplate supports many use cases, with convenient APIs to wrap.

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

There’s nothing to prevent you from having many steps within the flow elements.

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

All errors thrown from Spring Integration components will be a subclass of

A. Messaging
B. MessagingException
C. Exception
D. None of the mentioned
Answer» C. Exception
4.

Some invocations will fail but may be retried with some likelihood of success in a transactional scenario.

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

Spring Batch provides a lot of flexibility and guarantees to your application, but it cannot work in a vacuum. To do its work:-

A. Job
B. JobRepo
C. JobRepository
D. All of the mentioned
Answer» D. All of the mentioned
6.

Transaction capabilities are built on top of the first class support already provided by the core Spring framework.

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

The RetryTemplate itself is configured in the Spring context, although it’s trivial to create in code.

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

MapJobRegistry instance. This is critical—it is the central store for information regarding a given Job.

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

Attribute to configure how many items will be processed before the transaction is committed all the input is sent to the writer.

A. interval
B. commit
C. commit-interval
D. none of the mentioned
Answer» D. none of the mentioned
10.

Spring Integration provides the ability to catch exceptions and send them to an error channel of your choosing. By default, it’s a global channel called

A. error
B. exceptionChannel
C. exception
D. errorChannel
Answer» E.
11.

However, it’s important to wear another hat, that of a DBA, when writing applications.

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

You can specify exception classes on which to retry the operation.

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

Class which delegates the task of delimiting fields and records within a file to a LineMapper, which in turn delegates the task of identifying the fields within that record, to LineTokenizer.

A. org.springframework.batch.item.file.FlatFileItemReader
B. org.springframework.batch.item.file.FlatFile
C. org.springframework.batch.item.file.FlatFileItem
D. org.springframework.batch.item.file.FileItemReader
Answer» B. org.springframework.batch.item.file.FlatFile
14.

no-rollback-exception-classes element Exception classes that should not cause the transaction to roll back.

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

The output is constructed dynamically using MessageBuilder to create a message that has the same payload as the input message as well as copy the existing headers and adds an extra header:

A. randomlySelected
B. randomlySelectedForSurvey
C. randomly
D. none of the mentioned
Answer» C. randomly
16.

All errors that come from the integration in which this component is used will be directed to

A. customErrorChannel
B. customError
C. errorChannel
D. none of the mentioned
Answer» B. customError
17.

? should be replaced by:-

A. service:jmx:rmi://localhost/jndi/rmi://localhost:1099/replicator
B. service:jmx:rmi://localhost/jndi/rmi://localhost:1099/
C. service:jmx:rmi://localhost/jndi//localhost:1099/replicator
D. none of the mentioned
Answer» B. service:jmx:rmi://localhost/jndi/rmi://localhost:1099/
18.

The core interface of Spring email support is:-

A. MailSender
B. EMail
C. All of the mentioned
D. None of the mentioned
Answer» B. EMail
19.

You have to set the delegate property of MessageListenerAdapter to your target bean.

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

If you have a transaction requirement in receiving messages, you have to use:-

A. SimpleMessageListenerContainer
B. DefaultMessageListenerContainer
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
21.

For your front desk and back office classes, you can send and receive a map using the:-

A. convertAndSend()
B. receiveAndConvert()
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
22.

When you call the receive() method on a JMS message consumer to receive a message.

A. send
B. receive
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
23.

In the preceding sendMail() method, you first create JMS-specific ConnectionFactory.

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

You use Spring Integration’s inbound-channel-adapter element to wire the TwitterMessageSource and a poller element.

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

In JMS, there are two types of destinations:-

A. topic
B. queue
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
26.

To receive messages from an external system and process them using Spring Integration.

A. channel
B. channel adapter
C. EJP
D. none of the mentioned
Answer» C. EJP
27.

For correlation when you might not have a size but know that you’re expecting messages that share a common header value within a known time, Spring Integration provides the HeaderAttributeCorrelationStrategy.

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

Headers Found in Spring Integration Messages:-

A. ID
B. TIMESTAMP
C. CORRELATION_ID
D. All of the mentioned
Answer» E.
29.

JobLauncher reference you configured previously is obtained and used to then launch an instance of a Job.

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

Messages sent on the requests channel are forwarded to the:-

A. jms:outbound-gateway
B. jms:outbound
C. jms-gateway
D. all of the mentioned
Answer» B. jms:outbound
31.

There are some convenient default routers available to fill common needs:-

A. PayloadTypeRouter
B. PayloadType
C. Payload
D. None of the mentioned
Answer» B. PayloadType
32.

Spring Integration ships with useful splitters that require no customization.

A. Splitter
B. XPathMessageSplitter
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
33.

SimpleJobLauncher, whose sole purpose is to give you a mechanism to launch batch jobs, where a “job” in this case is our batch solution.

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

Using Spring JMS support with a very simple instance of:-

A. org.apache.activemq.ActiveMQConnectionFactory
B. org.apache.activemq.ActiveMQConnection
C. org.apache.activemq.ActiveMQ
D. None of the mentioned
Answer» B. org.apache.activemq.ActiveMQConnection
35.

Return type of the method annotated by the @Splitter annotation is of type:-

A. java.util.Collection
B. java.util.Date
C. all of the mentioned
D. none of the mentioned
Answer» B. java.util.Date
36.

Using an ESB lets you hide the origin of the message from the code that’s handling it.

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

You can explicitly specify on what channel errors for a given integration should go.

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

The API surfaces a Paging object, which works something like Criteria in Hibernate.

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

You want to work with a resource that may fail when you try to read from or write to it.

A. TransactionManager
B. Transaction
C. Spring batch retry
D. All of the mentioned
Answer» D. All of the mentioned
40.

Indeed, a step could be considered the smallest unit of work for a job. Input (what’s read) is passed to the Step and potentially processed; then output (what’s written) is created from the step.

A. Steplet
B. Tasklet
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
41.

Spring Batch models solutions using XML schema.

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

Adapters are opaque in nature.

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

Spring provides several types of message listener containers:-

A. SimpleMessageListenerContainer
B. DefaultMessageListenerContainer
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
44.

To send a JMS message with this template, you simply call:-

A. send
B. sendTo
C. all of the mentioned
D. none of the mentioned
Answer» B. sendTo
45.

Annotation which collects a series of messages (based on some correlation that you help Spring Integration make between the messages).

A. @After
B. @Splitter
C. @Aggregator
D. None of the mentioned
Answer» D. None of the mentioned
46.

Spring Batch provides a convenience class, CompositeItemProcessor, which forwards the output of the filter to the input of the successive filter.

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

Quartz supports several types of triggers:-

A. SimpleTrigger
B. CronTrigger
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
48.

The service-activator is what handles actual processing and there’s no mention of a response channel, for either the service-activator, or for the inbound JMS gateway.

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

The errorChannel doesn’t need to be a service-activator.

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

The code for the service-activator has changed to reflect the fact that you’re expecting a message containing a message of type:-

A. Message<java.io.File>
B. Message<java.io>
C. All of the mentioned
D. None of the mentioned
Answer» B. Message<java.io>