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

SessionFactory object configures Hibernate for the application using the supplied configuration file and allows for a Session object to be instantiated. The SessionFactory is a thread safe object and used by all the threads of an application.

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.

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.

Answer : D

Explaination

The <property> element is used to map a Java class property to a column in the database table. The name attribute of the element refers to the property in the class and the column attribute refers to the column in the database table. The type attribute holds the hibernate mapping type, this mapping types will convert from Java to SQL data type.

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

Read-only concurrency strategy is suitable for data which never changes. Use it for reference data only.

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

A - Transaction

B - SessionFactory

C - Session

D - All of the above

Answer : D

Explaination

All of the above mentioned are core component of Hibernate.

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