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.

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 save or update the state of the given instance from the underlying database?

A - Session.saveOrUpdate()

B - Session.keep()

C - Session.update()

D - Session.load()

Answer : A

Explaination

Session.saveOrUpdate either saves(Object) or updates(Object) the given instance.

Q 5 - Which of the following element is used to represent many-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 many-to-one association.

Q 6 - Child objects are not loaded when parent is loaded/populated from database. What this technique is called?

A - Eager Loading

B - Lazy Loading

C - Request based Loading

D - None of the above.

Answer : B

Explaination

In lazy loading child objects are not loaded when parent is loaded.

Answer : A

Explaination

The second-level cache is the SessionFactory based cache and is mainly responsible for caching objects across sessions.

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.

Q 9 - The Session object is lightweight.

A - false

B - true

Answer : B

Explaination

The Session object is lightweight and designed to be instantiated each time an interaction is needed with the database.

Q 10 - nullable attribute of @Column annotation permits the column to be marked NOT NULL when the schema is generated.

A - true

B - false

Answer : A

Explaination

nullable attribute of @Column annotation permits the column to be marked NOT NULL when the schema is generated.


hibernate_questions_answers.htm

Advertisements