- 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 - What ORM stands for?
Answer : B
Explaination
ORM stands for Object-Relational Mapping (ORM) is a programming technique for converting data between relational databases.
Q 2 - Which of the following is true about Query object in hibernate?
B - Query objects SQL string to retrieve data from the database and create objects.
Answer : D
Explaination
Query objects use SQL or Hibernate Query Language (HQL) string to retrieve data from the database and create objects. A Query instance is used to bind query parameters, limit the number of results returned by the query, and finally to execute the query.
Q 3 - Which of the following is true about transient state of a persistent entity?
A - A new instance of a persistent class which is not associated with a Session.
B - A new instance of a persistent class which has no representation in the database.
C - A new instance of a persistent class which has no identifier value.
Answer : D
Explaination
A new instance of a a persistent class which is not associated with a Session and has no representation in the database and no identifier value is considered transient by Hibernate.
Q 4 - Which method is used to get a persistent instance from the datastore?
Answer : B
Explaination
Session.get returns the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance.
Q 5 - Which of the following element maps java.util.List property in hibernate?
Answer : B
Explaination
java.util.List property is mapped with a <list> element and initialized with java.util.ArrayList.
Q 6 - Which of the following element is used to represent many-to-many relationship in hibernate?
Answer : A
Explaination
<many-to-many> element is used to define many-to-many association.
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 Transactional concurrency strategy is to be used?
Answer : B
Explaination
Use Transactional strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions.
Answer : B
Explaination
The SessionFactory is heavyweight object so usually it is created during application start up and kept for later use.
Q 10 - Which of the following is true about HQL?
A - Hibernate supports named parameters in its HQL queries.
B - HQL supports a range of aggregate methods, similar to SQL.
Answer : C
Explaination
Hibernate supports named parameters in its HQL queries. HQL supports a range of aggregate methods, similar to SQL.