250+ TOP MCQs on Controlling Step Execution and Job and Answers

Java Spring Multiple Choice Questions & Answers (MCQs) on “Controlling Step Execution and Job”.

1. You want to control how steps are executed, perhaps to eliminate a needless waste of time by:-
a) concurrent steps
b) decisions
c) sequential steps
d) all of the mentioned
Answer: d
Clarification: There are different ways to change the runtime profile of your jobs, mainly by exerting control over the way steps are executed: concurrent steps, decisions, and sequential steps.

2. Typical jobs of almost any complexity will have multiple steps, however.
a) True
b) False
Answer: a
Clarification: A step provides a boundary (transactional or not) to the beans and logic it encloses.

3. There’s nothing to prevent you from having many steps within the flow elements.
a) True
b) False
Answer: a
Clarification: Nor was there anything preventing you from having more steps after the split element. The split element, like the step elements, takes a next attribute as well.

4. Spring Batch provides a mechanism to offload processing to another process.
a) chunking
b) remote chunking
c) remote
d) none of the mentioned
Answer: b
Clarification: Spring Batch provides a mechanism to offload processing to another process. This feature, called remote chunking, is new in Spring Batch 2.x.

5. Pattern which refers to the arrangement of multiple JMS clients all consuming the same queue messages.
a) aggressive-consumer
b) aggressive
c) all of the mentioned
d) none of the mentioned
Answer: a
Clarification: If one client consumes a message and is busy processing, other idle queues will get the message instead.

6. Spring Batch ships with only handler, which executes steps in multiple threads using a TaskExecutor strategy.
a) TaskExecutorPartition
b) TaskExecutorPartitionHandler
c) TaskExecutorPartitionHandle
d) TaskExecutor
Answer: b
Clarification: This simple improvement might be enough of a justification for this feature! If you’re really hurting, however, you can extend it.

7. To determine the next step is the simplest example of a conditional flow.
a) Exit
b) Status
c) ExitStatus
d) None of the mentioned
Answer: c
Clarification: Spring Batch facilitates this through the use of the stop, next, fail, and end elements.

8. If you want to vary the execution flow based on some logic more complex than a job’s ExitStatuses:-
a) ExitStatus
b) Exit
c) Decision
d) All of the mentioned
Answer: c
Clarification: If you want to vary the execution flow based on some logic more complex than a job’s ExitStatuses, you may give Spring Batch a helping hand by using a decision element and providing it with an implementation of a JobExecutionDecider.

9. Spring Batch work with a system scheduler:-
a) cron
b) autosys
c) all of the mentioned
d) none of the mentioned
Answer: c
Clarification: Spring Batch work with a system scheduler such as cron or autosys, or from a web application.

10. JobLauncher reference you configured previously is obtained and used to then launch an instance of a Job.
a) True
b) False
Answer: a
Clarification: The result is a JobExecution. You can interrogate the JobExecution for information on the state of the Job, including its exit status and runtime status.

11. TaskExecutor that will spawn a thread of execution and manage that thread without blocking.
a) Async
b) Sync
c) Simple
d) SimpleAsyncTaskExecutor
Answer: d
Clarification: SimpleAsyncTaskExecutor will spawn a thread of execution and manage that thread without blocking.

12. The CommandLineJobRunner for success will return system error codes:-
a) 0
b) 1
c) 2
d) none of the mentioned
Answer: a
Clarification: The CommandLineJobRunner will even return system error codes (0 for success, 1 for failure, and 2 for an issue with loading the batch job) so that a shell (such as used by most system schedulers) can react or do something about the failure.

13. More complicated return codes can be returned by creating and declaring a top-level bean that implements the interface:-
a) ExitCode
b) ExitCodeMapper
c) ExitMapper
d) All of the mentioned
Answer: b
Clarification: More complicated return codes can be returned by creating and declaring a top-level bean that implements the interface ExitCodeMapper, in which you can specify a more useful translation of exit status messages to integer-based error codes that the shell will see on process exit.

14. The bean is recognized and becomes part of the application context because of the:-
a) @Component
b) @Attr
c) All of the mentioned
d) None of the mentioned
Answer: a
Clarification: The bean is recognized and becomes part of the application context because of the @Component annotation, which we enabled with the context:component-scan element in our reworked batch.xml (which we’re calling scheduled_batch.xml).

15. To parameterize a job, which is then available to your steps through Spring Batch expression language.
a) Job
b) Steps
c) JobParameters
d) None of the mentioned
Answer: c
Clarification: A job is a prototype of a JobInstance. JobParameters are used to provide a way of identifying a unique run of a job (a JobInstance). These JobParameters allow you to give input to your batch process, just as you would with a method definition in Java.

Leave a Reply

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