Hibernate
On This Page
This set of Advanced JAVA Multiple Choice Questions & Answers (MCQs) focuses on Hibernate
Q1 | Which of the following is not a core component of Hibernate?
- JDBC
- SessionFactory
- Session
- Configuration
Q2 | Is Session a thread-safe object?
- True
- False
- none
- all
Q3 | SessionFactory is a thread-safe object.
- True
- False
- none
- all
Q4 | Which of the following methods returns proxy object?
- loadDatabase()
- getDatabase()
- load()
- get()
Q5 | Which of the following methods hits database always?
- load()
- loadDatabase()
- getDatabase()
- get()
Q6 | Which of the following method is used inside session only?
- merge()
- update()
- end()
- kill()
Q7 | The SessionFactory is heavyweight object.
- False
- True
- none
- all
Q8 | Which of the following is not a state of object in Hibernate?
- Attached()
- Detached()
- Persistent()
- Transient()
Q9 | Which of the following is true about HQL?
- HQL takes java objects in the same way as SQL takes tables.
- HQL is a Object Oriented Query language
- HQL is database independent.
- All of the above.
Q10 | Which of the following is not an inheritance mapping strategies?
- Table per hierarchy
- Table per concrete class
- Table per subclass
- Table per class
Q11 | Which of the following is not an advantage of using Hibernate Query Language?
- Database independent
- Easy to write query
- No need to learn SQL
- Difficult to implement
Q12 | In which file database table configuration is stored?
- .dbm
- .hbm
- .ora
- .sql
Q13 | Which of the following is not an advantage of Hibernate Criteria API?
- Allows to use aggregate functions
- Cannot order the result set
- Allows to fetch only selected columns of result
- Can add conditions while fetching results
Q14 | What is the basic concept of Spring?
- Factory pattern
- Singleton pattern
- Dependency injection or Inversion of control
- Abstract factory pattern
Q15 | Which spring module provides the capability of DI or IOC?
- Spring web
- Core container
- AOP
- Data access
Q16 | What are beans in the concept of Spring or what are spring beans?
- Controller classes
- Service classes
- Repository
- Any class that is managed by the container.
Q17 | How does spring achieve DI or IOC?
- Service locator pattern
- Factory pattern
- Abstract factory pattern
- Singleton pattern
Q18 | Which interface in spring is responsible for Instantiating and managing the so calledSpring beans?
- Bean Factory
- ApplicationContext
- BeanDefenition
- BeanDefenition
Q19 | Beans can be created by which of the following properties?
- Scope
- Property
- Class
- It’s own constructor
Q20 | Which attribute is used to specify class name of the bean?
- name
- id
- class
- constructor-args
Q21 | Which of the following method can be used to used to instantiate a method?
- static factory method
- default-init method
- destroy method
- lazy-init method
Q22 | Which attribute is used to specify static factory-method?
- factory-method
- default-init method
- destroy method
- lazy-init method
Q23 | Purpose of Static Factory Method?
- Static method to create an object
- Initialize bean
- All of the mentioned
- None of the mentioned