- 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
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 JDBC?
A - JDBC stands for Java Database Connectivity.
B - JDBC provides a set of Java API for accessing the relational databases from Java program.
Answer : D
Explaination
JDBC stands for Java Database Connectivity and provides a set of Java API for accessing the relational databases from Java program. These Java APIs enables Java programs to execute SQL statements and interact with any SQL compliant database.
Q 2 - Which of the following is true about Transaction object in hibernate?
A - A Transaction represents a unit of work with the database.
B - Transactions in Hibernate are handled by an underlying transaction manager.
Answer : D
Explaination
A Transaction represents a unit of work with the database and most of the RDBMS supports transaction functionality. Transactions in Hibernate are handled by an underlying transaction manager and transaction (from JDBC or JTA).This is an optional object and Hibernate applications may choose not to use this interface, instead managing transactions in their own application code.
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 element of hbm.xml defines maps the unique ID attribute in class to the primary key of the database table?
Answer : A
Explaination
The <id> element maps the unique ID attribute in class to the primary key of the database table.
Q 5 - Which of the following element maps java.util.Set property in hibernate?
Answer : A
Explaination
java.util.Set property is mapped with a <set> element and initialized with java.util.HashSet.
Q 6 - What is the difference between save() and persist() methods of session object?
B - save saves the object and returns status whereas persist stores status in different variable.
Answer : C
Explaination
save saves the object and returns the id of the instance whereas persist do not return anything after saving the instance.
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 - 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.
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 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.