- 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 tools/frameworks provides integration with Hibernate?
Answer : D
Explaination
All of the above provide integration with Hibernate.
Q 2 - Which of the following is true about SessionFactory object in hibernate?
A - The SessionFactory is heavyweight object.
B - SessionFactory object is created during application start up and kept for later use.
C - You would need one SessionFactory object per database using a separate configuration file.
Answer : D
Explaination
The SessionFactory is heavyweight object so usually it is created during application start up and kept for later use. You would need one SessionFactory object per database using a separate configuration file. So if you are using multiple databases then you would have to create multiple SessionFactory objects.
Q 3 - Which of the following is true about persistent state of a persistent entity?
A - You can make a transient instance persistent by associating it with a Session.
B - A persistent instance has a representation in the database.
Answer : D
Explaination
You can make a transient instance persistent by associating it with a Session. A persistent instance has a representation in the database, an identifier value and is associated with a Session.
Q 4 - Which method is used to re-read the state of the given instance from the underlying database?
Answer : A
Explaination
Session.refresh re-reads the state of the given instance from the underlying database.
Q 5 - Which of the following is true about <generator> element?
Answer : C
Explaination
The <generator> element within the id element is used to automatically generate the primary key values. Set the class attribute of the generator element is set to native to let hibernate pick up either identity, sequence or hilo algorithm to create primary key depending upon the capabilities of the underlying database.
Q 6 - Which of the following element is used to represent one-to-many relationship in hibernate?
Answer : A
Explaination
<one-to-many> element is used to define one-to-many association.
Q 7 - What is Query level cache in hibernate?
Answer : A
Explaination
Hibernate implements a cache for query resultsets that integrates closely with the second-level cache.
Q 8 - Which of the following database is supported by Hibernate?
Answer : D
Explaination
All of the above mentioned databases are supported by Hibernate.
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