- 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 true about Hibernate?
A - Hibernate is an Object-Relational Mapping(ORM) solution for JAVA.
B - Hibernate is an Object-Relational Mapping(ORM) solution for .NET
Answer : A
Explaination
Hibernate is an Object-Relational Mapping(ORM) solution for JAVA.
Answer : B
Explaination
No, Session is not thread-safe.
Q 3 - Session.createQuery creates a new instance of Query for the given HQL query string.
Answer : A
Explaination
Session.createQuery creates a new instance of Query for the given HQL query string.
Q 4 - Which method is used to update the state of the given instance from the underlying database?
Answer : C
Explaination
Session.update updates the state of the given instance from the underlying database.
Q 5 - Which element of hbm.xml automatically generate the primary key values?
Answer : B
Explaination
The <generator> element within the id element is used to automatically generate the primary key values.
Q 6 - What is lazy loading?
A - Lazy loading is a technique in which objects are loaded on demand basis.
B - Lazy loading is a technique in which objects are persisted on demand basis.
Answer : A
Explaination
Lazy loading is a technique in which objects are loaded on demand basis.
Q 7 - What is second level cache in hibernate?
Answer : A
Explaination
The second-level cache is the SessionFactory based cache and is mainly responsible for caching objects across sessions.
Q 8 - When a Nonstrict-read-write concurrency strategy is to be used?
Answer : C
Explaination
Nonstrict-read-write strategy makes no guarantee of consistency between the cache and the database. Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical concern.
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