0% found this document useful (0 votes)
509 views6 pages

Hibernate Mock Test III

Hibernate

Uploaded by

jyowan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
509 views6 pages

Hibernate Mock Test III

Hibernate

Uploaded by

jyowan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
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 III

Q 1 - Which of the following element is used to represent one-to-one relationship in


hibernate?

A - <many-to-one>

B - <many-one>

C - <ManyToOne>

D - None of the above.

Q 2 - Which of the following element is used to represent one-to-many relationship in


hibernate?

A - <one-to-many>

B - <one-many>

C - <OneToMany>

D - None of the above.

Q 3 - Which of the following element is used to represent many-to-many relationship


in hibernate?

A - <many-to-many>

B - <many-many>

C - <ManyToMany>

D - None of the above.

Q 4 - Which of the following element is used to represent one-to-many relationship in


hibernate?
A - <one-to-many>

B - <one-many>

C - <OneToMany>

D - None of the above.

Q 5 - Which of the following situation represents many-to-many relationship?

A - An employee can have multiple certificates and same certificate can be conferred to many
employees.

B - An employee can have multiple certificates.

C - A certificate can be conferred to many employees.

D - All of the above.

Q 6 - What is the difference between save and persist methods of session object?

A - There is no difference.

B - save saves the object and returns status whereas persist stores status in different variable.

C - save saves the object and returns the id of the instance whereas persist do not return
anything after saving the instance.

D - None of the above.

Q 7 - What is the difference between get and load methods of session object?

A - get returns null if no data is present where as load throws ObjectNotFoundException


exception in such case.

B - get always hits the database whereas load method doesn't hit the database.

C - get returns actual object whereas load returns proxy object.

D - All of the above.

Q 8 - What is lazy loading?

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

B - Lazy loading is a technique in which objects are persisted on demand basis.

C - Both of the above.

D - None of the above.

Q 9 - What is value of lazy loading by default?

A - true

B - false
Q 10 - 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.

Q 11 - What HQL stands for?

A - Hibernate Query Language

B - High Query Language

C - Hybrid Query Language

D - None of the above.

Q 12 - Which of the following is true about HQL?

A - HQL takes java objects in the same way as SQL takes tables.

B - HQL is a Object Oriented Query language

C - HQL is database independent.

D - All of the above.

Q 13 - What is first level cache in hibernate?

A - The first-level cache is the Session based cache.

B - The first-level cache is the SessionFactory based cache.

C - Both of the above.

D - None of the above.

Q 14 - Whis of the following is true about first level cache in hibernate?

A - The first-level cache is the Session cache.

B - The first-level cache is a mandatory cache through which all requests must pass.

C - The Session object keeps an object under its own power before committing it to the database.

D - All of the above.

Q 15 - What is second level cache in hibernate?

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

B - The second-level cache is the Session based cache.


C - Both of the above.

D - None of the above.

Q 16 - Whis of the following is true about second level cache in hibernate?

A - The second-level cache is the SessionFactory based cache.

B - The second-level cache can be configured on a per-class and per-collection basis.

C - The second-level cache is mainly responsible for caching objects across sessions.

D - All of the above.

Q 17 - Is first level caching mandatory in hibernate?

A - true

B - false

Q 18 - Is second level caching mandatory in hibernate?

A - true

B - false

Q 19 - Is query level caching mandatory in hibernate?

A - true

B - false

Q 20 - What is Query level cache in hibernate?

A - The query-level cache is cache for query resultsets that integrates closely with the second-
level cache.

B - The query-level cache is the Session based cache.

C - Both of the above.

D - None of the above.

Q 21 - Which of the following is true about query level cache in hibernate?

A - Query level cache is an optional feature.

B - Query level cache requires two additional physical cache regions that hold the cached query
results and the timestamps when a table was last updated.

C - Query level cache is only useful for queries that are run frequently with the same parameters.

D - All of the above.

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


A - Transactional

B - Read-write

C - Nonstrict-read-write.

D - All of the above.

Q 23 - When a Transactional concurrency strategy is to be used?

A - Use it for reference data only.

B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.

C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.

D - None of the above.

Q 24 - When a Read-write concurrency strategy is to be used?

A - Use it for reference data only.

B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.

C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.

D - None of the above.

Q 25 - When a Nonstrict-read-write concurrency strategy is to be used?

A - Use it for reference data only.

B - Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent
transactions.

C - Use this strategy if data hardly ever changes and a small likelihood of stale data is not of
critical concern.

D - None of the above.

ANSWER SHEET

Question Number Answer Key

1 A

2 A

3 A

4 A

5 A

6 C
7 D

8 A

9 A

10 B

11 A

12 D

13 A

14 D

15 A

16 D

17 A

18 B

19 B

20 A

21 D

22 D

23 B

24 B

25 C

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

You might also like