Hibernate Post-Training Tests Hibernate Basic, Architecture, Configuration Q1) RDBMS has explicit way to represent inheritance and polymorphic associations. a) True b) False Ans: b Q2) Which of the following are NOT a part of the core Hibernate Architecture? a) Criteria b) CallBack c) Transaction d) Lifecycle e) All the above Ans: b,d Q3) session.delete(someUserObject). Which of the following statements are True. a) someUserObject will go from persistent state to detached state b) someUserObject will go from transient state to detached state c) someUserObject will go from persistent state to transient state d) None of the above Ans: c Q4) Scope of object identity in Hibernate is………….. a) no scope for object identity is maintained by Hibernate b) transaction scope c) process scope d) multiple jvm process scope e) All the above Ans: b Q5) Hibernate can be configured…. a) Programmatically using Configuration interface b) Using hibernate.cfg.xml file c) Using hibernate.properties file d) All the above Ans: d Q6) Hibernate does not allow custom naming strategy. a) True b) False. Ans: b
Hibernate Basic Mapping and Simple Relationships Q1) While creating a POJO which of the following are TRUE. a) A POJO MUST implement Serializable interface b) A POJO can be final class c) A POJO need not have its own equals() and hasCode() implementation d) Empty constructor is NOT required for a POJO. Ans: b,c Q2) native, identity, sequence, hilo & seqhilo are all database identity algorithms a) True b) False Ans: a Q3) lazy=”true” attribute ensures that all child objects in the object graph are loaded when the parent is loaded. a) True b) False Ans: b Q4) Table-per-class and Table-per-class-hierarchy are strategies to map …………. To RDBMS tables. Fill in the blanks. a) Associations b) Relationships c) Object identity d) None of the above Ans: d Q5) inverse=”true” ensures that POJOs on only one side of a bi-directional relationship is updated. a) True b) False Ans: a Q6) HQL uses objects and object attributes instead of table and column names. a) True b) False Ans: a
Hibernate Advanced Mappings and Collections Q1) maps and sets both allow duplicate items a) True b) False Ans: b Q2) tag is used to specify composite keys a) True b) False Ans: b Q3) Which of the following strategies use discriminator column a) Table-per-class b) Table-per-subclass c) Table-per-class-hierarchy d) All the above Ans: c Q4) Identifier generator can be used in compound keys a) True b) False Ans: b Q5) A <subclass> can contain multiple <joined-subclass> a) True b) False Ans: b
Hibernate Transactions and Querying Q1) Parameterised queries are not allowed in HQL a) True b) False Ans: b Q2) Without Object aliases hibernate uses outer joins to retrieve data. a) True b) False Ans: a Q3) read-ucommitted isolation level allows dirty reads a) True b) False
Ans: b Q4) Which of the following puts a pessimistic lock a) LockMode.NONE b) LockMode.READ c) LockMode.UPDGRADE d) LockMode.UPDGRADE_NOWAIT e) LockMode.WRITE Ans: c
Q5) Which of the following are true? a) Retrieves all Items and Bids b) Retrieves only Bids c) Retrieves only Items Ans: c