Explore topic-wise MCQs in Spring.

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

1.

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.FlatFileItemReaderb) org.springframework.batch.item.file.FlatFilec) org.springframework.batch.item.file.FlatFileItemd) org.springframework.batch.item.file.FileItemReaderAnswer: aExplanation: The FlatFileItemReader also declares a fieldSetMapper attribute that requires an implementation of FieldSetMapper. 11. The names and values for the named parameters are being created by the bean configured for the itemSqlParameterSourceProvider property, an instance of the interfacea) BeanPropertyItemSqlParameterSourceProviderb) BeanPropertyItemSqlParameterSourcec) BeanPropertyItemSqlParameterd) All of the mentionedAnswer: aExplanation: BeanPropertyItemSqlParameterSourceProvider, whose sole job it is to take JavaBean properties and make them available as named parameters corresponding to the property name on the JavaBean. 12. There’s support for writing JMS:-a) JmsItemWriterb) JpaItemWriterc) JdbcBatchItemWriterd) All of the mentionedAnswer: dExplanation: There’s support for writing JMS (JmsItemWriter), JPA (JpaItemWriter), JDBC (JdbcBatchItemWriter), Files (FlatFileItemWriter), iBatis (IbatisBatchItemWriter), Hibernate (HibernateItemWriter), and more. 13. The processor attribute on the chunk element expects a reference to a bean of the interface:-a) org.springframework.batch.item.Itemb) org.springframework.batch.itemc) org.springframework.batch.item.ItemProcessord) none of the mentionedAnswer: cExplanation: The processor attribute on the chunk element expects a reference to a bean of the interface org.springframework.batch.item.ItemProcessor. 14. Spring Batch provides a convenience class, CompositeItemProcessor, which forwards the output of the filter to the input of the successive filter.a) Trueb) FalseAnswer: aExplanation: In this way, you can write many, singly focused ItemProcessors and then reuse them and chain them as necessary.15. If the preceding job was run on a batch with a 100 rows, each item was read and passed through the processor, and it found 10 items invalid (it returned null 10 times), the value for the filter_count column would be:-

A. org.springframework.batch.item.file.FlatFileItemReaderb) org.springframework.batch.item.file.FlatFilec) org.springframework.batch.item.file.FlatFileItemd) org.springframework.batch.item.file.FileItemReaderAnswer: aExplanation: The FlatFileItemReader also declares a fieldSetMapper attribute that requires an implementation of FieldSetMapper. 11. The names and values for the named parameters are being created by the bean configured for the itemSqlParameterSourceProvider property, an instance of the interfacea) BeanPropertyItemSqlParameterSourceProviderb) BeanPropertyItemSqlParameterSourcec) BeanPropertyItemSqlParameterd) All of the mentionedAnswer: aExplanation: BeanPropertyItemSqlParameterSourceProvider, whose sole job it is to take JavaBean properties and make them available as named parameters corresponding to the property name on the JavaBean. 12. There’s support for writing JMS:-a) JmsItemWriterb) JpaItemWriterc) JdbcBatchItemWriterd) All of the mentionedAnswer: dExplanation: There’s support for writing JMS (JmsItemWriter), JPA (JpaItemWriter), JDBC (JdbcBatchItemWriter), Files (FlatFileItemWriter), iBatis (IbatisBatchItemWriter), Hibernate (HibernateItemWriter), and more. 13. The processor attribute on the chunk element expects a reference to a bean of the interface:-a) org.springframework.batch.item.Itemb) org.springframework.batch.itemc) org.springframework.batch.item.ItemProcessord) none of the mentionedAnswer: cExplanation: The processor attribute on the chunk element expects a reference to a bean of the interface org.springframework.batch.item.ItemProcessor. 14. Spring Batch provides a convenience class, CompositeItemProcessor, which forwards the output of the filter to the input of the successive filter.a) Trueb) FalseAnswer: aExplanation: In this way, you can write many, singly focused ItemProcessors and then reuse them and chain them as necessary.15. If the preceding job was run on a batch with a 100 rows, each item was read and passed through the processor, and it found 10 items invalid (it returned null 10 times), the value for the filter_count column would be:-a) 100
B. org.springframework.batch.item.file.FlatFilec) org.springframework.batch.item.file.FlatFileItemd) org.springframework.batch.item.file.FileItemReaderAnswer: aExplanation: The FlatFileItemReader also declares a fieldSetMapper attribute that requires an implementation of FieldSetMapper. 11. The names and values for the named parameters are being created by the bean configured for the itemSqlParameterSourceProvider property, an instance of the interfacea) BeanPropertyItemSqlParameterSourceProviderb) BeanPropertyItemSqlParameterSourcec) BeanPropertyItemSqlParameterd) All of the mentionedAnswer: aExplanation: BeanPropertyItemSqlParameterSourceProvider, whose sole job it is to take JavaBean properties and make them available as named parameters corresponding to the property name on the JavaBean. 12. There’s support for writing JMS:-a) JmsItemWriterb) JpaItemWriterc) JdbcBatchItemWriterd) All of the mentionedAnswer: dExplanation: There’s support for writing JMS (JmsItemWriter), JPA (JpaItemWriter), JDBC (JdbcBatchItemWriter), Files (FlatFileItemWriter), iBatis (IbatisBatchItemWriter), Hibernate (HibernateItemWriter), and more. 13. The processor attribute on the chunk element expects a reference to a bean of the interface:-a) org.springframework.batch.item.Itemb) org.springframework.batch.itemc) org.springframework.batch.item.ItemProcessord) none of the mentionedAnswer: cExplanation: The processor attribute on the chunk element expects a reference to a bean of the interface org.springframework.batch.item.ItemProcessor. 14. Spring Batch provides a convenience class, CompositeItemProcessor, which forwards the output of the filter to the input of the successive filter.a) Trueb) FalseAnswer: aExplanation: In this way, you can write many, singly focused ItemProcessors and then reuse them and chain them as necessary.15. If the preceding job was run on a batch with a 100 rows, each item was read and passed through the processor, and it found 10 items invalid (it returned null 10 times), the value for the filter_count column would be:-a) 100b) 1
C. org.springframework.batch.item.file.FlatFileItemd) org.springframework.batch.item.file.FileItemReaderAnswer: aExplanation: The FlatFileItemReader also declares a fieldSetMapper attribute that requires an implementation of FieldSetMapper. 11. The names and values for the named parameters are being created by the bean configured for the itemSqlParameterSourceProvider property, an instance of the interfacea) BeanPropertyItemSqlParameterSourceProviderb) BeanPropertyItemSqlParameterSourcec) BeanPropertyItemSqlParameterd) All of the mentionedAnswer: aExplanation: BeanPropertyItemSqlParameterSourceProvider, whose sole job it is to take JavaBean properties and make them available as named parameters corresponding to the property name on the JavaBean. 12. There’s support for writing JMS:-a) JmsItemWriterb) JpaItemWriterc) JdbcBatchItemWriterd) All of the mentionedAnswer: dExplanation: There’s support for writing JMS (JmsItemWriter), JPA (JpaItemWriter), JDBC (JdbcBatchItemWriter), Files (FlatFileItemWriter), iBatis (IbatisBatchItemWriter), Hibernate (HibernateItemWriter), and more. 13. The processor attribute on the chunk element expects a reference to a bean of the interface:-a) org.springframework.batch.item.Itemb) org.springframework.batch.itemc) org.springframework.batch.item.ItemProcessord) none of the mentionedAnswer: cExplanation: The processor attribute on the chunk element expects a reference to a bean of the interface org.springframework.batch.item.ItemProcessor. 14. Spring Batch provides a convenience class, CompositeItemProcessor, which forwards the output of the filter to the input of the successive filter.a) Trueb) FalseAnswer: aExplanation: In this way, you can write many, singly focused ItemProcessors and then reuse them and chain them as necessary.15. If the preceding job was run on a batch with a 100 rows, each item was read and passed through the processor, and it found 10 items invalid (it returned null 10 times), the value for the filter_count column would be:-a) 100b) 1c) 10
D. org.springframework.batch.item.file.FileItemReaderAnswer: aExplanation: The FlatFileItemReader also declares a fieldSetMapper attribute that requires an implementation of FieldSetMapper. 11. The names and values for the named parameters are being created by the bean configured for the itemSqlParameterSourceProvider property, an instance of the interfacea) BeanPropertyItemSqlParameterSourceProviderb) BeanPropertyItemSqlParameterSourcec) BeanPropertyItemSqlParameterd) All of the mentionedAnswer: aExplanation: BeanPropertyItemSqlParameterSourceProvider, whose sole job it is to take JavaBean properties and make them available as named parameters corresponding to the property name on the JavaBean. 12. There’s support for writing JMS:-a) JmsItemWriterb) JpaItemWriterc) JdbcBatchItemWriterd) All of the mentionedAnswer: dExplanation: There’s support for writing JMS (JmsItemWriter), JPA (JpaItemWriter), JDBC (JdbcBatchItemWriter), Files (FlatFileItemWriter), iBatis (IbatisBatchItemWriter), Hibernate (HibernateItemWriter), and more. 13. The processor attribute on the chunk element expects a reference to a bean of the interface:-a) org.springframework.batch.item.Itemb) org.springframework.batch.itemc) org.springframework.batch.item.ItemProcessord) none of the mentionedAnswer: cExplanation: The processor attribute on the chunk element expects a reference to a bean of the interface org.springframework.batch.item.ItemProcessor. 14. Spring Batch provides a convenience class, CompositeItemProcessor, which forwards the output of the filter to the input of the successive filter.a) Trueb) FalseAnswer: aExplanation: In this way, you can write many, singly focused ItemProcessors and then reuse them and chain them as necessary.15. If the preceding job was run on a batch with a 100 rows, each item was read and passed through the processor, and it found 10 items invalid (it returned null 10 times), the value for the filter_count column would be:-a) 100b) 1c) 10d) 1000Answer: cExplanation: You could see that a 100 items were read from the read_count. The write_count column would reflect that 10 items didn’t make it and would show 90.Sanfoundry Global Education & Learning Series – Java Spring.To practice all areas of Java Spring, here is complete set of 1000+ Multiple Choice Questions and Answers.Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!Telegram | Youtube | LinkedIn | Instagram | Facebook | Twitter | PinterestYoutube | LinkedIn | Instagram | Facebook | Twitter | Pinterest« Prev - Spring Questions and Answers – Spring Batch and Gateways» Next - Spring Questions and Answers – Transactions and Retrying
Answer» B. org.springframework.batch.item.file.FlatFilec) org.springframework.batch.item.file.FlatFileItemd) org.springframework.batch.item.file.FileItemReaderAnswer: aExplanation: The FlatFileItemReader also declares a fieldSetMapper attribute that requires an implementation of FieldSetMapper. 11. The names and values for the named parameters are being created by the bean configured for the itemSqlParameterSourceProvider property, an instance of the interfacea) BeanPropertyItemSqlParameterSourceProviderb) BeanPropertyItemSqlParameterSourcec) BeanPropertyItemSqlParameterd) All of the mentionedAnswer: aExplanation: BeanPropertyItemSqlParameterSourceProvider, whose sole job it is to take JavaBean properties and make them available as named parameters corresponding to the property name on the JavaBean. 12. There’s support for writing JMS:-a) JmsItemWriterb) JpaItemWriterc) JdbcBatchItemWriterd) All of the mentionedAnswer: dExplanation: There’s support for writing JMS (JmsItemWriter), JPA (JpaItemWriter), JDBC (JdbcBatchItemWriter), Files (FlatFileItemWriter), iBatis (IbatisBatchItemWriter), Hibernate (HibernateItemWriter), and more. 13. The processor attribute on the chunk element expects a reference to a bean of the interface:-a) org.springframework.batch.item.Itemb) org.springframework.batch.itemc) org.springframework.batch.item.ItemProcessord) none of the mentionedAnswer: cExplanation: The processor attribute on the chunk element expects a reference to a bean of the interface org.springframework.batch.item.ItemProcessor. 14. Spring Batch provides a convenience class, CompositeItemProcessor, which forwards the output of the filter to the input of the successive filter.a) Trueb) FalseAnswer: aExplanation: In this way, you can write many, singly focused ItemProcessors and then reuse them and chain them as necessary.15. If the preceding job was run on a batch with a 100 rows, each item was read and passed through the processor, and it found 10 items invalid (it returned null 10 times), the value for the filter_count column would be:-a) 100b) 1
2.

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
3.

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. is passed to the Step and potentially processed; then output (what’s written) is created from the step.a) Stepletb) Taskletc) All of the mentionedd) None of the mentioned
Answer» C. All of the mentioned
4.

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

A. True
B. False
Answer» B. False
5.

Spring Batch models solutions using XML schema.

A. True
B. False
Answer» B. False
6.

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
Answer» B. False
7.

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

A. True
B. False
Answer» B. False
8.

To load the contents of a properties file (batch.properties) whose values you use to configure the data source.

A. PropertyPlaceholder
B. PropertyPlaceholderConfigurer
C. Property
D. PropertyConfigurer
Answer» C. Property
9.

There’s only one really useful implementation of the JobRepository interface, which stores information about the state of the batch processes in a database.

A. SimpleJobRepository
B. SimpleJob
C. SimpleRepo
D. All of the mentioned
Answer» B. SimpleJob
10.

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