- 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 - Cascade Types
- Hibernate - Annotations
- Hibernate - Query Language
- Hibernate - Criteria Queries
- Hibernate - Native SQL
- Hibernate - Caching
- Hibernate - Entity Lifecycle
- Hibernate - Batch Processing
- Hibernate - Interceptors
- Hibernate - ID Generator
- Hibernate - Saving Image
- Hibernate - log4j Integration
- Hibernate - Spring Integration
- Hibernate - Struts 2 Integration
- Hibernate - Web Application
- Mapping Table Examples
- Hibernate - Table Per Hiearchy
- Hibernate - Table Per Concrete Class
- Hibernate - Table Per Subclass
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?
Answer : D
Explaination
All of the above options are true about 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 - Session.createSQLQuery creates a new instance of Query for the given SQL query string.
Answer : A
Explaination
Session.createSQLQuery creates a new instance of Query for the given SQL 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 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 situation represents many-to-many relationship?
B - An employee can have multiple certificates.
Answer : A
Explaination
An employee can have multiple certificates and same certificate can be conferred to many employees. Such situation represents many-to-many association.
Q 7 - Whis of the following is true about second level cache in hibernate?
A - The second-level cache is the SessionFactory based cache.
B - The second-level cache can be configured on a per-class and per-collection basis.
C - The second-level cache is mainly responsible for caching objects across sessions.
Answer : D
Explaination
Second level cache is an optional cache and first-level cache will always be consulted before any attempt is made to locate an object in the second-level cache. The second-level cache can be configured on a per-class and per-collection basis and mainly responsible for caching objects across sessions.
Q 8 - Which of the following is true about hibernate?
A - Hibernate does not require an application server to operate.
B - Hibernate manipulates Complex associations of objects of your database.
C - Hibernate minimize database access with smart fetching strategies.
Answer : D
Explaination
All of the above are true with respect to hibernate.
Q 9 - Which of the following is true about hibernate annotations?
Answer : A
Explaination
Hibernate Annotations is the powerful way to provide the metadata for the Object and Relational Table mapping. All the metadata is clubbed into the POJO java file along with the code this helps the user to understand the table structure and POJO simultaneously during the development.
Q 10 - Which of the following is true about HQL?
A - Hibernate Query Language (HQL) is an object-oriented query language.
Answer : C
Explaination
Hibernate Query Language (HQL) is an object-oriented query language, similar to SQL, but instead of operating on tables and columns, HQL works with persistent objects and their properties.