Hibernate MCQ Questions and Answers
Some of the important Hibernate MCQ Questions and Answers are given below:
01. Which of the following database is not supported by Hibernate?
- FoundationDB
- MySQL
- PostgreSQL
- DB2/NT
Answer : A Explanation: FoundationDB is a NoSQL database and is not supported by Hibernate and hence option A is correct.
02. The hibernate XML configuration file name is?
- hibernate.cfg.xml
- hibernate.cg.xml
- hibernate.config.xml
- None of the mentioned
Answer : A Explanation: The hibernate XML configuration file name is hibernate.cfg.xml
03. Which of the following is not a core interface of Hibernate?
- Configuration
- Criteria
- SessionManagement
- Session
Answer : C Explanation: SessionManagement is not a core interface of Hibernate but Configuration, Criteria, SessionFactory, Session, Query and Transaction are the core interfaces of Hibernate. So option C is correct.
04. Hibernate SessionFactory represent which level of cache?
- Second Level
- Third Level
- First Level
- Fourth Level
Answer : A Explanation: Hibernate SessionFactory represent Second level of cache. So option A is correct.
05. While creating SessionFactory in hibernate, which design pattern should be adopted?
- Prototype
- Singleton
Answer : B Explanation: SessionFactory is built at the time of application startup and it follows the singleton design pattern. So option B is correct.
06. What is ORM?
- ORM is the automated persistence of objects in a Java application to the tables in a relational database
- ORM stands for object-relational mapping
- Both A & B
- None of the mentioned
Answer : C Explanation: ORM is the automated persistence of objects in a Java application to the tables in a relational database as well as ORM stands for object-relational mapping. So both of them are correct.
07. What does the Session object hold?
- Second Level Cache
- First Level Cache
- Both A & B
- None of the mentioned
Answer : B Explanation: The Session object holds first level cache. So answer B is correct.
08. In which file database table configuration is stored?
- .dbm
- .ora
- .sql
- .hbm
Answer : D Explanation: Database table configuration is stored in a .hbm file.
09. Which method is used to save the state of the given instance from the underlying database?
- Session.load()
- Session.save()
- Session.store()
- Session.keep()
Answer : B Explanation: Session.save is used to save the state of the given instance from the underlying database.
10. Which element in hibernate maps java.util.SortedMap property ?
- < list >
- < set >
- < map >
- < tree >
Answer : C Explanation: < map > in hibernate maps java.util.SortedMap property.
Pingback: Java MCQ Questions and Answers - cozmocard
Pingback: Data Structure MCQ Questions and Answers - cozmocard