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

Answer : B

Explaination

ORM stands for Object-Relational Mapping (ORM) is a programming technique for converting data between relational databases.

Answer : D

Explaination

Query objects use SQL or Hibernate Query Language (HQL) string to retrieve data from the database and create objects. A Query instance is used to bind query parameters, limit the number of results returned by the query, and finally to execute the query.

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.

Q 4 - Which of the following is the root node of hbm.xml file?

A - hibernate-mapping

B - hibernate-config

C - class-mapping

D - class-config

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.List property in hibernate?

A - <set>

B - <list>

C - <bag>

D - <map>

Answer : B

Explaination

java.util.List property is mapped with a <list> element and initialized with java.util.ArrayList.

Q 6 - Which of the following element is used to represent one-to-one relationship in hibernate?

A - <many-to-one>

B - <many-one>

C - <ManyToOne>

D - None of the above.

Answer : A

Explaination

<many-to-one> element is used to define one-to-one association.

Answer : A

Explaination

HQL stands for Hibernate Query Language.

Answer : B

Explaination

Use Transactional strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions.

Q 9 - Configuration object is used to create SessionFactory object in hibernate.

A - true

B - false

Answer : A

Explaination

Configuration object is used to create a SessionFactory object.

Answer : C

Explaination

HQL queries are translated by Hibernate into conventional SQL queries which in turns perform action on database. The AS clause can be used to assign aliases to the classes in your HQL queries.

hibernate_questions_answers.htm
Advertisements