Explore topic-wise MCQs in Spring.

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

1.

To accept a session factory via dependency injection.

A. HibernateCourseDao
B. HibernateCourse
C. HibernateDao
D. All of the mentioned
Answer» B. HibernateCourse
2.

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

A. True
B. False
Answer» B. False
3.

Interface whose instances can be obtained from an EntityManagerFactory instance.

A. Entity
B. EntityManager
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
4.

Interface whose instances can be obtained from a SessionFactory instance.

A. Session
B. Session Factory
C. All of the mentioned
D. None of the mentioned
Answer» B. Session Factory
5.

INTERFACE_WHOSE_INSTANCES_CAN_BE_OBTAINED_FROM_AN_ENTITYMANAGERFACTORY_INSTANCE.?$

A. Entity
B. EntityManager
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
6.

To accept a session factory via dependency injection.$

A. HibernateCourseDao
B. HibernateCourse
C. HibernateDao
D. All of the mentioned
Answer» B. HibernateCourse
7.

The_exceptions_thrown_by_Hibernate_are_of_type_HibernateException,_while_those_thrown_by_JPA_may_be_of_type_PersistenceException.$

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

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

A. LocalEntityManagerFactoryBean
B. LocalContainerEntityManagerFactoryBean
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned
9.

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

A. LocalEntityManagerFactoryBean
B. LocalEntityManagerFactory
C. LocalEntityManager
D. All of the mentioned
Answer» B. LocalEntityManagerFactory
10.

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

A. True
B. False
Answer» B. False
11.

Property for factory bean to load the Hibernate configuration file.

A. config.xml
B. config
C. configLocation
D. none of the mentioned
Answer» D. none of the mentioned
12.

Interface whose instances can be obtained from a SessionFactory instance?

A. Session
B. Session Factory
C. All of the mentioned
D. None of the mentioned
Answer» B. Session Factory
13.

Core Programming Elements for Different Data Access Strategies.

A. Resource
B. Resource Factory
C. Session
D. All of the mentioned
Answer» E.
14.

For mapping and persisting your objects with Hibernate and JPA.

A. Using the Hibernate API to persist objects with Hibernate XML mappings
B. Using the Hibernate API to persist objects with JPA annotations
C. Using JPA to persist objects with JPA annotations
D. All of the mentioned
Answer» E.
15.

A set of persistent annotations for you to define mapping metadata.

A. JPA
B. JSR
C. XML
D. None of the mentioned
Answer» B. JSR
16.

To allow the identifier to be null, you should choose a primitive wrapper type:-

A. java.lang.Integer
B. java.lang.Long
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
17.

If the identifier value is null, this entity will be treated as a new and unsaved entity.

A. True
B. False
Answer» B. False
18.

Each entity class to be persisted by an ORM framework, a default constructor with no argument is required.

A. True
B. False
Answer» B. False
19.

Class which represents a real-world entity and its instances will be persisted to a database.

A. entity
B. persistent
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned