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 is not an ORM framework?

A - Castor

B - Spring DAO

C - Hibernate

D - NoSQL

Answer : D

Explaination

NoSQL is not an ORM framework.

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 - Session.createQuery creates a new instance of Query for the given HQL query string.

A - true

B - false

Answer : A

Explaination

Session.createQuery creates a new instance of Query for the given HQL query string.

Q 4 - Which method is used to re-read the state of the given instance from the underlying database?

A - Session.refresh()

B - Session.get()

C - Session.reload()

D - Session.retrieve()

Answer : A

Explaination

Session.refresh re-reads the state of the given instance from the underlying database.

Q 5 - Which of the following element maps java.util.SortedMap property in hibernate?

A - <set>

B - <list>

C - <bag>

D - <map>

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 value of lazy loading by default?

A - true

B - false

Answer : A

Explaination

Since Hibernate 3, lazy loading is by default, enabled so that child objects are not loaded when parent is loaded.

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.

Answer : C

Explaination

@Entity annotation marks a class as an entity bean, so it must have a no-argument constructor that is visible with at least protected scope.

Q 10 - length attribute of @Column annotation permits the size of the column used to map a value particularly for a String value.

A - false

B - true

Answer : B

Explaination

length attribute of @Column annotation permits the size of the column used to map a value particularly for a String value.

hibernate_questions_answers.htm
Advertisements