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 not an ORM framework?
Answer : D
Explaination
NoSQL is not an ORM framework.
Q 2 - Which of the following is true about configuration component of Hibernate?
A - The Configuration object is the first Hibernate object you create in any Hibernate application.
B - The Configuration object is usually created only once during application initialization.
Answer : D
Explaination
The Configuration object is the first Hibernate object you create in any Hibernate application and usually created only once during application initialization. It represents a configuration or properties file required by the Hibernate.
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 <class> element?
B - The Java class name is specified using the name attribute of the class element.
C - The database table name is specified using the table attribute of the class element.
Answer : D
Explaination
The <class> elements are used to define specific mappings from a Java classes to the database tables. The Java class name is specified using the name attribute of the class element and the database table name is specified using the table attribute.
Q 5 - Which of the following element is used to represent many-to-one relationship in hibernate?
Answer : A
Explaination
<many-to-one> element is used to define many-to-one association.
Q 6 - Child objects are not loaded when parent is loaded/populated from database. What this technique is called?
Answer : B
Explaination
In lazy loading child objects are not loaded when parent is loaded.
Q 7 - Which of the following is true about HQL?
A - HQL takes java objects in the same way as SQL takes tables.
B - HQL is a Object Oriented Query language
Answer : D
Explaination
HQL takes java objects in the same way as SQL takes tables. HQL is a Object Oriented Query language and is database independent.
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 : A
Explaination
Configuration object is used to create a SessionFactory object.
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.