Hibernate Mock Test
Hibernate Mock Test
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.
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
A - Session.delete
B - Session.remove
C - Session.del
D - Session.rm
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
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.
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
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.
A - id
B - generator
C - primaryKey
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.
A - id
B - generator
C - property
D - class
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.
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <set>
B - <list>
C - <bag>
D - <map>
A - <many-to-one>
B - <many-one>
C - <ManyToOne>
ANSWER SHEET
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