- 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 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?
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 detached state of a persistent entity?
A - Once we close the Hibernate Session, the persistent instance will become a detached instance.
B - A new instance of a persistent class which is not associated with a Session.
C - You can make a transient instance detached by associating it with a Session.
Answer : A
Explaination
Once we close the Hibernate Session, the persistent instance will become a detached instance.
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 of the following element maps java.util.SortedMap property in hibernate?
Answer : D
Explaination
This is mapped with a <map> element and initialized with java.util.TreeMap. The sort attribute can be set to either a comparator or natural ordering.
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.
Answer : B
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.
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
Configuration object is used to create a SessionFactory object.
Q 10 - nullable attribute of @Column annotation permits the column to be marked NOT NULL when the schema is generated.
Answer : A
Explaination
nullable attribute of @Column annotation permits the column to be marked NOT NULL when the schema is generated.
To Continue Learning Please Login
Login with Google