0% found this document useful (0 votes)
138 views

Hibernate Mock Test

Hibernate

Uploaded by

jyowan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views

Hibernate Mock Test

Hibernate

Uploaded by

jyowan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

HIBERNATE MOCK TEST

http://www.tutorialspoint.com Copyright © tutorialspoint.com

This section presents you various set of Mock Tests related to Hibernate Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

HIBERNATE MOCK TEST II

Q 1 - Session.createCriteria creates a new Criteria instance, for the given entity class,
or a superclass of an entity class.

A - true

B - false

Q 2 - Session.createQuery creates a new instance of Query for the given HQL query
string.

A - true

B - false

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

A - true

B - false

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

A - true

B - false

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

A - Session.delete

B - Session.remove
C - Session.del

D - Session.rm

Q 6 - Which method is used to get a persistent instance from the datastore?

A - Session.read

B - Session.get

C - Session.retrieve

D - Session.fetch

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

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

A - Session.store

B - Session.keep

C - Session.save

D - Session.load

Q 9 - 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

Q 10 - 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
Q 11 - Which of the following is the root node of hbm.xml file?

A - hibernate-mapping

B - hibernate-config

C - class-mapping

D - class-config

Q 12 - Which of the following elements is used to define specific mappings from a Java
classes to the database tables?

A - property

B - hibernate-config

C - class

D - class-config

Q 13 - Which of the following is true about <class> element?

A - The <class> elements are used to define specific mappings from a Java classes to the
database tables.

B - The Java class name is specified using the name attribute of the class element.

C - The database table name is specified using the table attribute of the class element.

D - All of the above.

Q 14 - Which element of hbm.xml defines maps the unique ID attribute in class to the
primary key of the database table?

A - id

B - generator

C - primaryKey

D - None of the above.

Q 15 - Which of the following is true about <id> element?

A - The <id> element maps the unique ID attribute in class to the primary key of the database
table.

B - The name attribute of the id element refers to the property in the class.

C - The column attribute of the id element refers to the column in the database table.

D - All of the above.

Q 16 - Which element of hbm.xml automatically generate the primary key values?

A - id
B - generator

C - primaryKey

D - None of the above.

Q 17 - Which of the following is true about <generator> element?

A - The <generator> element within the id element is used to automatically generate the
primary key values

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

C - Both of the above.

D - None of the above.

Q 18 - 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

Q 19 - Which of the following is true about <property> element?

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

B - The name attribute of the element refers to the property in the class.

C - The column attribute of the element refers to the column in the database table.

D - All of the above.

Q 20 - Which of the following element maps java.util.Set property in hibernate?

A - <set>

B - <list>

C - <bag>

D - <map>

Q 21 - Which of the following element maps java.util.List property in hibernate?

A - <set>

B - <list>

C - <bag>
D - <map>

Q 22 - Which of the following element maps java.util.Collection property in hibernate?

A - <set>

B - <list>

C - <bag>

D - <map>

Q 23 - Which of the following element maps java.util.Map property in hibernate?

A - <set>

B - <list>

C - <bag>

D - <map>

Q 24 - Which of the following element maps java.util.SortedMap property in


hibernate?

A - <set>

B - <list>

C - <bag>

D - <map>

Q 25 - 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 SHEET

Question Number Answer Key

1 A

2 A

3 B

4 A

5 A
6 B

7 A

8 C

9 C

10 A

11 A

12 C

13 D

14 A

15 D

16 B

17 C

18 C

19 D

20 A

21 B

22 C

23 D

24 D

25 A

Loading [MathJax]/jax/output/HTML-CSS/jax.js

You might also like