- 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 ORM?
A - ORM stands for Object-Relational Mapping.
B - ORM is a programming technique for converting data between relational databases.
Answer : C
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 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 - Which of the following is true about hibernate.dialect property in hibernate configuration?
A - This property makes Hibernate generate the appropriate SQL for the chosen database.
B - This property makes Hibernate generate the appropriate java code for the chosen database.
Answer : A
Explaination
This property makes Hibernate generate the appropriate SQL for the chosen database.
Q 4 - Which of the following is true about <id> element?
A - The <id> element maps the unique ID attribute in class to the primary key of the database table.
B - The name attribute of the id element refers to the property in the class.
C - The column attribute of the id element refers to the column in the database table.
Answer : D
Explaination
The <id> element maps the unique ID attribute in class to the primary key of the database table. The name attribute of the id element refers to the property in the class and the column attribute refers to the column in the database table. The type attribute holds the hibernate mapping type, this mapping types will convert from Java to SQL data type.
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 - 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 - Whis of the following is true about first level cache in hibernate?
A - The first-level cache is the Session cache.
B - The first-level cache is a mandatory cache through which all requests must pass.
C - The Session object keeps an object under its own power before committing it to the database.
Answer : D
Explaination
The first-level cache is the Session cache and is a mandatory cache through which all requests must pass. The Session object keeps an object under its own power before committing it to the database.
Q 8 - When a Read-write concurrency strategy is to be used?
Answer : B
Explaination
Use Read-write strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions.
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 - length attribute of @Column annotation permits the size of the column used to map a value particularly for a String value.
Answer : B
Explaination
length attribute of @Column annotation permits the size of the column used to map a value particularly for a String value.