- 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 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 object is used to create SessionFactory object in hibernate?
Answer : A
Explaination
Configuration object is used to create a SessionFactory object.
Q 3 - Which of the following is true about persistent state of a persistent entity?
A - You can make a transient instance persistent by associating it with a Session.
B - A persistent instance has a representation in the database.
Answer : D
Explaination
You can make a transient instance persistent by associating it with a Session. A persistent instance has a representation in the database, an identifier value and is associated with a Session.
Q 4 - Which of the following is the root node of hbm.xml file?
Answer : A
Explaination
The mapping document is an XML document having <b><hibernate-mapping></b> as the root element which contains all the <class> elements.
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 - 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 - 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 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
Persistent objects are saved and retrieved through a Session object.
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.