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.

Questions and Answers

Q 1 - Which of the following tools/frameworks provides integration with Hibernate?

A - XDoclet Spring

B - J2EE

C - Maven

D - All of the above.

Answer : D

Explaination

All of the above provide integration with Hibernate.

Q 2 - Which of the following is not a core component of Hibernate?

A - Transaction

B - Provider

C - Criteria

D - Query

Answer : B

Explaination

Provider is not a core component of Hibernate.

Q 3 - Session.createSQLQuery creates a new instance of Query for the given HQL query string.

A - true

B - false

Answer : B

Explaination

Session.createSQLQuery creates a new instance of Query for the given SQL query string.

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 maps java.util.Map property in hibernate?

A - <set>

B - <list>

C - <bag>

D - <map>

Answer : D

Explaination

java.util.Map property is mapped with a <map> element and initialized with java.util.HashMap.

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 : A

Explaination

HQL stands for Hibernate Query Language.

Answer : D

Explaination

Query level cache is an optional feature and requires two additional physical cache regions that hold the cached query results and the timestamps when a table was last updated. This is only useful for queries that are run frequently with the same parameters.

Q 9 - Persistent objects are saved and retrieved through a Session object.

A - false

B - true

Answer : B

Explaination

Persistent objects are saved and retrieved through a Session object.

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.

hibernate_questions_answers.htm
Advertisements