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 a core component of Hibernate?

A - JDBC

B - SessionFactory

C - Session

D - Configuration

Answer : A

Explaination

JDBC is not a core component of Hibernate.

Q 2 - Which of the following is not a core component of Hibernate?

A - Transaction

B - Provider

C - Criteria

D - Query

Answer : B

Explaination

Provider is not a core component of Hibernate.

Q 3 - Which method is used to remove a persistent instance from the datastore?

A - Session.delete()

B - Session.remove()

C - Session.del()

D - Session.rm()

Answer : A

Explaination

Session.delete() removes a persistent instance from the datastore.

Answer : D

Explaination

The <class> elements are used to define specific mappings from a Java classes to the database tables. The Java class name is specified using the name attribute of the class element and the database table name is specified using the table attribute.

Answer : C

Explaination

The <generator> element within the id element is used to automatically generate the primary key values. Set the class attribute of the generator element is set to native to let hibernate pick up either identity, sequence or hilo algorithm to create primary key depending upon the capabilities of the underlying database.

Answer : A

Explaination

Lazy loading is a technique in which objects are loaded on demand basis.

Q 7 - Is first level caching mandatory in hibernate?

A - true

B - false

Answer : A

Explaination

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

Q 8 - Which of the following is a concurrency strategies in hibernate?

A - Transactional

B - Read-write

C - Nonstrict-read-write.

D - All of the above.

Answer : D

Explaination

All of the above are concurrency strategies in hibernate.

Answer : A

Explaination

Hibernate Annotations is the powerful way to provide the metadata for the Object and Relational Table mapping. All the metadata is clubbed into the POJO java file along with the code this helps the user to understand the table structure and POJO simultaneously during the development.

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