Hibernate Online Quiz


Advertisements


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.

Q 2 - Is SessionFactory a thread-safe object?

A - true

B - false

Answer : A

Explaination

Yes, SessionFactory is a thread-safe and can be accessed by multiple threads simultaneously.

Answer : D

Explaination

A new instance of a a persistent class which is not associated with a Session and has no representation in the database and no identifier value is considered transient by Hibernate.

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

A - Session.store()

B - Session.keep()

C - Session.update()

D - Session.load()

Answer : C

Explaination

Session.update updates the state of the given instance from the underlying database.

Q 5 - Which element of hbm.xml is used to map a Java class property to a column in the database table?

A - id

B - generator

C - property

D - class

Answer : C

Explaination

The <property> element is used to map a Java class property to a column in the database table.

Answer : C

Explaination

save saves the object and returns the id of the instance whereas persist do not return anything after saving the instance.

Answer : A

Explaination

The first-level cache is the Session cache and is a mandatory cache through which all requests must pass.

Answer : C

Explaination

Nonstrict-read-write strategy makes no guarantee of consistency between the cache and the database. Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical concern.

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 - name attribute of @Column annotation permits the name of the column to be explicitly specified.

A - true

B - false

Answer : A

Explaination

name attribute of @Column annotation permits the name of the column to be explicitly specified.


hibernate_questions_answers.htm

Advertisements