Spring/Spring Mcq Set 12 Sample Test,Sample questions

Question:
 A transaction manager is declared in the Spring IoC container as a normal bean.

1.True

2. False

3.none

4.all the mentoined


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

1.@Translation

2.@Repo

3. @Repository

4.None of the mentioned


Question:
 Annotation used for entity manager injection in EJB components.

1.@PersistenceContext

2.@Persistence

3.@Persistence

4.None of the mentioned


Question:
 FactoryBean to create an entity manager factory in the IoC container.

1. LocalEntityManagerFactoryBean

2. LocalEntityManagerFactory

3.LocalEntityManager

4. all of the mentioned


Question:
 For mapping and persisting your objects with Hibernate and JPA.

1.Using the Hibernate API to persist objects with Hibernate XML mappings

2.Using the Hibernate API to persist objects with JPA annotations

3.Using JPA to persist objects with JPA annotations

4.all of the mentioned


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

1.True

2.False

3.none

4.all the mentoined


Question:
 Interface whose instances can be obtained from a SessionFactory instance.

1. Session

2.Session Factory

3.All of the mentioned

4.none of the mentioned


Question:
 Interface whose instances can be obtained from an EntityManagerFactory instance.

1.Entity

2.EntityManager

3.All of the mentioned

4.None of the mentioned


Question:
 PlatformTransactionManager is an abstract unit for transaction management.

1.True

2.False

3.none

4.all the mentoined


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

1.HibernateTemplate

2. JpaTemplate

3.SpringTemplate

4.None of the mentioned


Question:
 The PlatformTransactionManager interface provides methods for working with transactions:

1.getTransaction(TransactionDefinition definition)

2.commit(TransactionStatus status)

3.rollback(TransactionStatus status)

4.All of the mentioned


Question:
 To access a database running on the Derby server, you have to add:-

1.Derby client library

2.Tomcat client library

3.All of the mentioned

4.None of the mentioned


Question:
 To help you control the overall transaction management process and transaction exception handling.

1. SpringTransactionTemplate

2.TransactionTemplate

3. Transaction

4.None of the mentioned


Question:
 Transactions can be described with key properties:-

1.Atomicity

2. Consistency

3. Isolation

4. all of the mentioned


Question:
 You can omit the transaction-manager attribute in the element if your transaction manager has the name transactionManager.

1.True

2.False

3.none

4.all the mentoined


Question:
A transaction propagation behavior can be specified by the:-

1.propagation

2.consistency

3.isolation

4.All of the mentioned


Question:
A TransactionTemplate can accept a transaction callback object that implements:-

1.TransactionCallback

2.TransactionCallbackWithoutResult class

3. All of the mentioned

4.None of the mentioned


Question:
An alternative to Spring HibernateTemplate is:-

1.HibernateContext

2.Hibernate contextual sessions

3. All of the mentioned

4.None of the mentioned


Question:
Annotation to find a transaction and then fail, complaining that no Hibernate session been bound to the thread.

1. @Transaction

2.@Transactional

3.@Transactions

4.none of the mentioned


Question:
Core Programming Elements for Different Data Access Strategies.

1.Resource

2.Resource Factory

3. Session

4.All of the mentioned


Question:
DAO methods must be made transactional.

1. True

2.False

3.none

4.all the mentoined


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

1. a setter method

2.constructor argument

3.none of the mentioned

4. all of the mentioned


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

1. Dirty Read

2.Nonrepeatable read

3. Phantom read

4. Lost Updates


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

1. Required

2.REQUIRES NEW

3.SUPPORTS

4. NOT SUPPORTED


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

1.Required

2.MANDATORY

3.NESTED

4.NEVER


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

1.Required

2.REQUIRES NEW

3. SUPPORTS

4.NOT SUPPORTED


Question:
If you want to use this data source for your session factory, you can inject it into the dataSource property of LocalSessionFactoryBean.

1. True

2. False

3.none

4.all the mentoined


Question:
In the bean configuration file for Hibernate (i.e., beans-hibernate.xml), you have to declare a HibernateTransactionManager instance for this application and enable declarative transaction via:-

1.tx:annotation

2. tx:annotationdriven

3.tx:annotation-driven

4. none of the mentioned


Question:
Instance to translate the native Hibernate exceptions into data access exceptions in Spring DataAccessException hierarchy.

1.PersistenceExceptionPostProcessor

2. PersistenceExceptionTranslation

3.PersistenceException

4. PersistenceExceptionTranslationPostProcessor


Question:
It allows you to override some of the configurations in the JPA configuration file.

1.LocalEntityManagerFactoryBean

2.LocalContainerEntityManagerFactoryBean

3.All of the mentioned

4.None of the mentioned


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

1.True

2. False

3.none

4.all the mentoined


Question:
Method that allows you to start a new transaction (or obtain the currently active transaction).

1.getTransaction()

2.commit()

3.rollback()

4.All of the mentioned


Question:
Method to start a new transaction with that definition:-

1.getTransaction()

2. commit()

3.rollback()

4.None of the mentioned


Question:
Property for factory bean to load the Hibernate configuration file.

1.config.xml

2. config

3.configLocation

4.None of the mentioned


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

1.getSession() method

2.getCurrent() method

3. getCurrentSession() method

4. none of the mentioned


Question:
Spring (since version 2.0) offers a transaction advice that can be easily configured via the:-

1. rx:advice

2.bx:advice

3.tx:advice

4.None of the mentioned


Question:
Spring has several built-in implementations of PlatformTransactionManager interface for use with different transaction management APIs.

1.True

2.False

3.none

4.all the mentoined


Question:
Spring HibernateTemplate can simplify your DAO implementation by managing sessions and transactions for you.

1.True

2.False

3.none

4.all the mentoined


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

1.PlatformTransaction

2.PlatformTransactionManager

3.TransactionManager

4.PlatformManager


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

1.org.springframework.transaction.PlatformTransactionManager

2.org.springframework.transaction.support.TransactionTemplate

3.all of the mentioned

4.None of the mentioned


Question:
The current method must run within a transaction.

1. Required

2. MANDATORY

3. SUPPORTS

4.NOT SUPPORTED


Question:
The current method must start a new transaction and run within its own transaction.

1.Required

2.REQUIRES NEW

3.SUPPORTS

4.NOT SUPPORTED


Question:
The current method should not run within a transaction.

1. Required

2.REQUIRES NEW

3. SUPPORTS

4.NOT SUPPORTED


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

1.Required

2.MANDATORY

3.SUPPORTS

4.NEVER


Question:
The exceptions thrown by Hibernate are of type HibernateException, while those thrown by JPA may be of type PersistenceException.

1.True

2.False

3.none

4.all the mentoined


Question:
To accept a session factory via dependency injection.

1.HibernateCourseDao

2.HibernateCourse

3.HibernateDao

4.All of the mentioned


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

1. True

2. False

3.none

4.all the mentoined


Question:
Transaction propagation behavior are defined in the:-

1.org.springframework.transaction.Transaction

2.org.springframework.transaction.TransactionDefinition

3. all of the mentioned

4.None of the mentioned


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

1.True

2.False

3.none

4.all the mentoined


Question:
You just have to encapsulate your code block in a callback class that implements the TransactionCallback interface and pass it to the TransactionTemplate execute method for execution. In this way, you don’t need to repeat the boilerplate transaction management code for this block.

1.True

2. False

3.none

4.all the mentoined


More MCQS

  1. Spring Mcq Set 1
  2. Spring Mcq Set 2
  3. Spring Mcq Set 3
  4. Spring Mcq Set 4
  5. Spring Mcq Set 5
  6. Spring Mcq Set 6
  7. Spring Mcq Set 7
  8. Spring Mcq Set 8
  9. Spring Mcq Set 9
  10. Spring Mcq Set 10
  11. Spring Mcq Set 11
  12. Spring Mcq Set 12
  13. Spring Mcq Set 13
  14. Spring Mcq Set 14
  15. Spring Mcq Set 15
  16. Spring Mcq Set 16
  17. Spring Mcq Set 17
  18. Spring Mcq Set 18
  19. Spring Mcq Set 19
  20. Spring Mcq Questions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!