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

Answer : A

Explaination

Hibernate is an Object-Relational Mapping(ORM) solution for JAVA.

Answer : D

Explaination

The SessionFactory is heavyweight object so usually it is created during application start up and kept for later use. You would need one SessionFactory object per database using a separate configuration file. So if you are using multiple databases then you would have to create multiple SessionFactory objects.

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

A - true

B - false

Answer : A

Explaination

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

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 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 - 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.

Q 7 - Is query level caching mandatory in hibernate?

A - true

B - false

Answer : B

Explaination

query level cache is an optional cache.

Q 8 - Which of the following database is not supported by Hibernate?

A - Oracle

B - Microsoft SQL Server Database

C - FoundationDB

D - Informix Dynamic Server

Answer : C

Explaination

FoundationDB is a NoSQL database and is not supported by Hibernate.

Answer : C

Explaination

Hibernate detects that the @Id annotation is on a field and assumes that it should access properties on an object directly through fields at runtime.

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