Sunteți pe pagina 1din 12

1. Which of the following are hibernate fetching strategies?

(choose 4)

a) select

b) join

c) update

d) batch

e) lazy collection

2. The proxy attribute in Hibernate enables lazy initialization of persistent instances of the class. (choose 1)

a) True

b) False

3. Which of the following is true about Hibernate's Session object? (choose 2)

a) Session is opened using SessionFactory.

b) SessionFactory is opened using Session.

c) Hibernate's Sesion represents a single datastore.

d) Hibernate's Sesion represents a single unit-of-work with the database.

4. How can you map a whole class as immutable in Hibernate? (choose 1)

a) By setting mutable="true"

b) By setting mutable="false"

c) By setting immutable="false"

d) By setting immutable="true"

e) None of the above

5. Which of the following are some main interfaces provided by Hibernate? (choose 3)

a) org.hibernate.HibernateSession

b) org.hibernate.Session

c) org.hibernate.SessionFactory

d) org.hibernate.Criteria

6. Which of the following ways can be used to represent joins in Hibernate? (choose 4)

a) An explicit association join.

b) An implicit association join.

c) An ordinary join in the FROM clause.

d) A fetch join in the FROM clause.


e) A theta-style join in the WHERE clause.

7. Which of the following are true about derived properties? (choose 1)

a) Derived properties are mapped to a column.

b) Derived properties are not mapped to a column, but calculated at runtime.

c) Derived properties are columns belonging to a subclass.

d) None of the above.

8. How can you make sure a property you read from a database table is not modified in anyway? (choose 1)

a) By setting insert="false" and update="false" attributes.

b) By setting insert="true" and update="true" attributes.

c) By setting insert="true" and update="false" attributes.

d) None of the above.

9. The attribute dynamic-insert in a class mapping specifies that insert sql should be generated at runtime
and contain only the columns whose values are not null. (choose 1)

a) True

b) False

10. When you place both hibernate.properties and hibernate.cfg.xml in the classpath, the settings of
hibernate.properties will override hibernate.cfg.xml. (choose 1)

a) True

b) False

11. Which of the following is true about HibernateTemplate? (choose 2)

a) This class provides different methods for querying/retrieving data from the database.

b) This class provides different methods for generating java classes.

c) This class converts checked HibernateExceptions into unchecked DataAccessExceptions.

d) This class converts unchecked DataAccessExceptions into checked HibernateExceptions.

12. Is Hibernate SessionFactory thread-safe? (choose 1)

a) True

b) False

13. Which of the following is true about session.update() method and session.lock() method? (choose 2)

a) The session.lock() method simply reattaches the detached object to the session without checking or
updating the database.

b) The session.lock() method checks the database to make sure it is in sync and then reattaches the
detached object to the session.

c) The session.update() method checks the database to make sure it is in sync and then reattaches the
detached object to the session.

d) The session.update() method simply reattaches the detached object to the session without checking
or updating the database.

14. Is Session object thread-safe? (choose 1)

a) True

b) False

15. Which of the following ways can be used for configuring hibernate? (choose 2)

a) Placing hibernate.properties in classpath.

b) Placing Application.properties in classpath.

c) none of the below and above.

d) Placing hibernate.cfg.xml in classpath

16. Which of the following is true about Hibernate SessionFactory? (choose 1)

a) Hibernate's SessionFactory represents a single datastore.

b) Hibernate's SessionFactory represents multipe datastores.

c) Hibernate's SessionFactory represents a single session.

d) Hibernate's SessionFactory represents multipe sessions.

e) None of the above

17. Hibernate principle is used in which of the following technologies? (choose 1)

a) EJB 4.0

b) EJB 2.0

c) EJB 3.0

d) None of the above

18. The inverse option in a one-to-many mapping indicates which end of the relationship should be used?
(choose 1)

a) True

b) False

19. Which of the following is true about ORM? (choose 1)

a) ORM technique allows you to view the underlying data/database tables as object based.

b) ORM technique allows you to view code modules as object based.

c) ORM technique provides with you with an in-built database.


d) None of the above.

20. Which of the following are true about detached objects? (choose 1)

a) Detached objects can be detached from a session and later can only be re-attached to the same
session.

b) Detached objects can be detached from a session and later re-attached to a differnet session.

c) Detached objects can be detached only once.

d) None of the above.

21. Which of the following is true about session.get() method and session.load() method? (choose 2)

a) If object being loaded/retrieved from database does not exist, session.get() returns null.

b) If object being loaded/retrieved from database does not exist, session.get() throws an exception.

c) If object being loaded/retrieved from database does not exist, session.load() returns null.

d) If object being loaded/retrieved from database does not exist, session.load() throws an exception.

22. You are currently using MySql database and you are required to switch to Oracle database. How do you
accomplish this in Hibernate without making any code changes and keeping the changes minimal? (choose 1)

a) By only changing the jar files.

b) By using Hibernate SQL dialects.

c) Keeping all SQL queries in properties file.

d) None of the above.

23. How do you configure Hibernate to access an instance variable directly instead of via a setter method?
(choose 1)

a) By setting the property access="direct" in Hibernate metadata.

b) By setting the property access="instance" in Hibernate metadata.

c) By setting the property access="property" in Hibernate metadata.

d) By setting the property access="field" in Hibernate metadata.

24. Which of the following can be used to log all sql statements in the console? (choose 1)

a) By setting the hibernate.display_sql property to true.

b) By setting the hibernate.show_sql property to true.

c) By setting the hibernate.sql_to_console property to true.

d) By setting the hibernate.show_sql_console property to true.

e) None of the above.

25. Which of the following collection types are supported by Hibernate? (choose 4)
a) Set

b) List

c) Bag

d) Basket

e) Map

User Id: idatoo


Course Name: Hibernate (160)
Grade: 19/25
Percentage: 76.0%
Detailed Results: Question #1
[Correct],
category:
[Session]
Question #2
[Correct],
category:
[Hibernate]
Question #3
[Correct],
category:
[Hibernate]
Question #4
[Correct],
category:
[Configuration]
Question #5
[Correct],
category:
[Session]
Question #6
[Correct],
category:
[Hibernate]
Question #7
[Correct],
category:
[Hibernate]
Question #8
[Correct],
category:
[Hibernate]
Question #9 [In-
correct],
category:
[Hibernate]
Question #10
[Correct],
category:
[SessionFactory]
Question #11 [In-
correct],
category:
[SessionFactory]
Question #12
[Correct],
category:
[Hibernate]
Question #13 [In-
correct],
category:
[Hibernate]
Question #14
[Correct],
category:
[Configuration]
Question #15
[Correct],
category:
[Hibernate]
Question #16
[Correct],
category:
[Hibernate]
Question #17 [In-
correct],
category: [Joins]
Question #18
[Correct],
category:
[Hibernate]
Question #19
[Correct],
category:
[Session]
Question #20 [In-
correct],
category:
[Hibernate]
Question #21
[Correct],
category:
[Hibernate]
Question #22
[Correct],
category:
[Hibernate]
Question #23
[Correct],
category:
[Session]
Question #24
[Correct],
category:
[Hibernate]
Question #25 [In-
correct],
category:
[Hibernate]

Joins: 0/1 (0%)


Configuration:
2/2 (100%)
Session: 4/4
(100%)
Results grouped by category:
Hibernate: 12/16
(75%)
SessionFactory:
1/2 (50%)

Sat Nov 15
Start time: 21:22:05 CST
2008
Sat Nov 15
End time: 21:35:38 CST
2008
13 minutes 33
Duration:
seconds

21. Which of the following is true about ORM? (choose 1)

a) ORM technique allows you to view the underlying data/database tables as object based.

b) ORM technique allows you to view code modules as object based.

c) ORM technique provides with you with an in-built database.


d) None of the above.

22. Which of the following are true about detached objects? (choose 1)

a) Detached objects can be detached from a session and later can only be re-attached to the same
session.

b) Detached objects can be detached from a session and later re-attached to a differnet session.

c) Detached objects can be detached only once.

d) None of the above.

23. Which of the following is true about session.update() method and session.lock() method? (choose 2)

a) The session.lock() method simply reattaches the detached object to the session without checking or
updating the database.

b) The session.lock() method checks the database to make sure it is in sync and then reattaches the
detached object to the session.

c) The session.update() method checks the database to make sure it is in sync and then reattaches the
detached object to the session.

d) The session.update() method simply reattaches the detached object to the session without checking
or updating the database.

24. Which of the following can be used to log all sql statements in the console? (choose 1)

a) By setting the hibernate.display_sql property to true.

b) By setting the hibernate.show_sql property to true.

c) By setting the hibernate.sql_to_console property to true.

d) By setting the hibernate.show_sql_console property to true.

e) None of the above.

25. Which of the following are true about derived properties? (choose 1)

a) Derived properties are mapped to a column.

b) Derived properties are not mapped to a column, but calculated at runtime.

c) Derived properties are columns belonging to a subclass.

d) None of the above.

16. The attribute dynamic-insert in a class mapping specifies that insert sql should be generated at runtime
and contain only the columns whose values are not null. (choose 1)

a) True

b) False

17. Which of the following ways can be used to represent joins in Hibernate? (choose 4)

a) An explicit association join.


b) An implicit association join.

c) An ordinary join in the FROM clause.

d) A fetch join in the FROM clause.

e) A theta-style join in the WHERE clause.

18. Which of the following collection types are supported by Hibernate? (choose 4)

a) Set

b) List

c) Bag

d) Basket

e) Map

19. Which of the following is true about Hibernate's Session object? (choose 2)

a) Session is opened using SessionFactory.

b) SessionFactory is opened using Session.

c) Hibernate's Sesion represents a single datastore.

d) Hibernate's Sesion represents a single unit-of-work with the database.

20. You are currently using MySql database and you are required to switch to Oracle database. How do you
accomplish this in Hibernate without making any code changes and keeping the changes minimal? (choose 1)

a) By only changing the jar files.

b) By using Hibernate SQL dialects.

c) Keeping all SQL queries in properties file.

d) None of the above.

11. Which of the following is true about Hibernate SessionFactory? (choose 1)

a) Hibernate's SessionFactory represents a single datastore.

b) Hibernate's SessionFactory represents multipe datastores.

c) Hibernate's SessionFactory represents a single session.

d) Hibernate's SessionFactory represents multipe sessions.

e) None of the above

12. Hibernate principle is used in which of the following technologies? (choose 1)

a) EJB 4.0

b) EJB 2.0

c) EJB 3.0
d) None of the above

13. Which of the following is true about HibernateTemplate? (choose 2)

a) This class provides different methods for querying/retrieving data from the database.

b) This class provides different methods for generating java classes.

c) This class converts checked HibernateExceptions into unchecked DataAccessExceptions.

d) This class converts unchecked DataAccessExceptions into checked HibernateExceptions.

14. Which of the following ways can be used for configuring hibernate? (choose 2)

a) Placing hibernate.properties in classpath.

b) Placing Application.properties in classpath.

c) none of the below and above.

d) Placing hibernate.cfg.xml in classpath

15. When you place both hibernate.properties and hibernate.cfg.xml in the classpath, the settings of
hibernate.properties will override hibernate.cfg.xml. (choose 1)

a) True

b) False

6. Which of the following are hibernate fetching strategies? (choose 4)

a) select

b) join

c) update

d) batch

e) lazy collection

7. The proxy attribute in Hibernate enables lazy initialization of persistent instances of the class. (choose 1)

a) True

b) False

8. How can you make sure a property you read from a database table is not modified in anyway? (choose 1)

a) By setting insert="false" and update="false" attributes.

b) By setting insert="true" and update="true" attributes.

c) By setting insert="true" and update="false" attributes.

d) None of the above.

9. The inverse option in a one-to-many mapping indicates which end of the relationship should be used?
(choose 1)
a) True

b) False

10. Is Hibernate SessionFactory thread-safe? (choose 1)

a) True

b) False

1. Is Session object thread-safe? (choose 1)

a) True

b) False

2. Which of the following are some main interfaces provided by Hibernate? (choose 3)

a) org.hibernate.HibernateSession

b) org.hibernate.Session

c) org.hibernate.SessionFactory

d) org.hibernate.Criteria

3. How can you map a whole class as immutable in Hibernate? (choose 1)

a) By setting mutable="true"

b) By setting mutable="false"

c) By setting immutable="false"

d) By setting immutable="true"

e) None of the above

4. How do you configure Hibernate to access an instance variable directly instead of via a setter method?
(choose 1)

a) By setting the property access="direct" in Hibernate metadata.

b) By setting the property access="instance" in Hibernate metadata.

c) By setting the property access="property" in Hibernate metadata.

d) By setting the property access="field" in Hibernate metadata.

5. Which of the following is true about session.get() method and session.load() method? (choose 2)

a) If object being loaded/retrieved from database does not exist, session.get() returns null.

b) If object being loaded/retrieved from database does not exist, session.get() throws an exception.

c) If object being loaded/retrieved from database does not exist, session.load() returns null.

d) If object being loaded/retrieved from database does not exist, session.load() throws an exception.

S-ar putea să vă placă și