- Hibernate Tutorial
- Hibernate - Home
- ORM - Overview
- Hibernate - Overview
- Hibernate - Architecture
- Hibernate - Environment
- Hibernate - Configuration
- Hibernate - Sessions
- Hibernate - Persistent Class
- Hibernate - Mapping Files
- Hibernate - Mapping Types
- Hibernate - Examples
- Hibernate - O/R Mappings
- Hibernate - Annotations
- Hibernate - Query Language
- Hibernate - Criteria Queries
- Hibernate - Native SQL
- Hibernate - Caching
- Hibernate - Batch Processing
- Hibernate - Interceptors
- Hibernate Useful Resources
- Hibernate - Questions and Answers
- Hibernate - Quick Guide
- Hibernate - Useful Resources
- Hibernate - Discussion
Hibernate Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Hibernate Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - Which of the following is not a core component of Hibernate?
Answer : A
Explaination
JDBC is not a core component of Hibernate.
Q 2 - Which of the following is true about SessionFactory object in hibernate?
B - SessionFactory object allows for a Session object to be instantiated.
Answer : D
Explaination
SessionFactory object configures Hibernate for the application using the supplied configuration file and allows for a Session object to be instantiated. The SessionFactory is a thread safe object and used by all the threads of an application.
Q 3 - Session.createCriteria creates a new Criteria instance, for the given entity class, or a superclass of an entity class.
Answer : A
Explaination
Session.createCriteria creates a new Criteria instance, for the given entity class, or a superclass of an entity class.
Q 4 - Which of the following elements is used to define specific mappings from a Java classes to the database tables?
Answer : C
Explaination
The <class> elements are used to define specific mappings from a Java classes to the database tables. The Java class name is specified using the name attribute of the class element and the database table name is specified using the table attribute.
Q 5 - Which of the following element maps java.util.Map property in hibernate?
Answer : D
Explaination
java.util.Map property is mapped with a <map> element and initialized with java.util.HashMap.
Q 6 - Which of the following element is used to represent one-to-one relationship in hibernate?
Answer : A
Explaination
<many-to-one> element is used to define one-to-one association.
Q 7 - Which of the following is true about HQL?
A - HQL takes java objects in the same way as SQL takes tables.
B - HQL is a Object Oriented Query language
Answer : D
Explaination
HQL takes java objects in the same way as SQL takes tables. HQL is a Object Oriented Query language and is database independent.
Q 8 - Which of the following is true about query level cache in hibernate?
A - Query level cache is an optional feature.
C - Query level cache is only useful for queries that are run frequently with the same parameters.
Answer : D
Explaination
Query level cache is an optional feature and requires two additional physical cache regions that hold the cached query results and the timestamps when a table was last updated. This is only useful for queries that are run frequently with the same parameters.
Answer : A
Explaination
A Session is used to get a physical connection with a database.
Q 10 - Which of the following is true about @GeneratedValue annotation?
A - @GeneratedValue annotation takes two parameters strategy and generator.
B - @GeneratedValue annotation provides the primary key generation strategy to be used.
Answer : C
Explaination
By default, the @Id annotation will automatically determine the most appropriate primary key generation strategy to be used but you can override this by applying the @GeneratedValue annotation which takes two parameters strategy and generator.
To Continue Learning Please Login
Login with Google