Hibernate MCQ

Hibernate MCQ

  • Admin
  • 14th Jun, 2022

Hibernate MCQ Questions and Answers

Following are mostly asked Hibernate MCQ test that are designed for professionals like you to crack you interviews. You can take this Hibernate online test before appearing to you real interview. This Hibernate quiz there are around 30+ multiple choice questions on Hibernate with four options.

1) Which of the following is not an advantage of using Hibernate Query Language?

  • A. Database independent
  • B. Easy to write query
  • C. No need to learn SQL
  • D. Difficult to implement

2) In which file database table configuration is stored?

  • A. .dbm
  • B. .hbm
  • C. .ora
  • D. .sql

3) Which of the following is not an inheritance mapping strategies?

  • A. Table per hierarchy
  • B. Table per concrete class
  • C. Table per subclass
  • D. Table per class

4) Which of the following method is used inside session only?

  • A. merge()
  • B. update()
  • C. end()
  • D. kill()

5) Which of the following methods hits database always?

  • A. load()
  • B. loadDatabase()
  • C. getDatabase()
  • D. get()
Download Free : Hibernate MCQ PDF

6) SessionFactory is a thread-safe object.

  • A. True
  • B. False

7) What is ORM?

  • A. Object Relational Mapping
  • B. Operating Rate Mapping
  • C. Operating Related Mapping
  • D. Object Rate Mapping

8) The QBC stands for __.

  • A. Query By Call
  • B. Query By Column
  • C. Query By Criteria
  • D. Query By Code

9) Which of the following methods returns proxy object?

  • A. loadDatabase()
  • B. load()
  • C. getDatabase()
  • D. get()

10) Which of the following is not a core interface of Hibernate?

  • A. Configuration
  • B. Criteria
  • C. SessionManagement
  • D. Session

11) Which of the following object is used to create SessionFactory object in hibernate?

  • A. Configuration
  • B. Session
  • C. SessionFactory
  • D. Transaction

12) The POJOs stands for ___.

  • A. Plane Old Java Objects
  • B. Particular Old Java Objectswrong
  • C. Plain Open Java Objects
  • D. Plain Old Java Objects

13) Which of the following is not an advantage of Hibernate Criteria API?

  • A. Allows to use aggregate functions
  • B. Cannot order the result set
  • C. Allows to fetch only selected columns of result
  • D. Can add conditions while fetching results

14) Which of the following is NOT a fetching strategy?

  • A. Dselect Fetching
  • B. Sub-select Fetching
  • C. Select Fetching
  • D. Join Fetching

15) Which of the following are most common configuration methods of Hibernate Configuation?

  • A. Mapping files
  • B. Http.conf
  • C. XML Configuration hibernate.cfg.xml
  • D. Web.config

16) Which of these simplifies an Object Relational Mapping tool?

  • A. Data creation
  • B. Data manipulation
  • C. Data access
  • D. All mentioned above

17) Which of the following is FALSE about Session in hibernate

  • A. Session is a light weight non-threadsafe object
  • B. You can share the session between threads
  • C. Session represents a single unit-of-work with the database
  • D. Session is the primary interface for the persistence service

18) Which of the following is not a Session method?

  • A. Session.save()
  • B. Session.remove()
  • C. Session.saveorupdate()
  • D. Session.persist()

19) Which statement is correct?

  • A. Only the Session that you obtained with sf.getCurrentSession() is flushed and closed automatically
  • B. Only the Session that you obtained with sf.openSession() is flushed and closed automatically
  • C. Only the Session that you obtained with sf.getNewSession() is flushed and closed automatically
  • D. None of the above

20) Does Hibernate support polymorphism?

  • A. Yes
  • B. No

21) Which facility provides tools for development of distributed, web based solutions.

  • A. JMX API
  • B. JVM
  • C. JRE
  • D. All of the above

22) Which of the following is NOT a mapping association used in Hibernate?

  • A. Many-to-Many Association
  • B. One-to-Many Association
  • C. One-to-One Association
  • D. None

23) What does the Session object hold?

  • A. First Level Cache
  • B. Second Level Cache
  • C. Both A & B
  • D. None of the above

24) Abbreviate the term HQL?

  • A. Hibernate Queue Language
  • B. Hibernate Query Language
  • C. Hipher Query Language
  • D. None of the above

Hibernate Online Test Questions (Hibernate FAQs)

1) What is Hibernate?

Hibernate is a Java framework that is used to simplify the development of Java applications to interact with the database. Hibernate is an open-source, lightweight, ORM i.e. Object Relational Mapping tool.

2) What is an ORM?

ORM or Object-relational mapping is used to write the complicated queries by using the object-oriented paradigm of the preferred programming language.

3) List some advantages of hibernate over JDBC?

Advantages of Hibernate over JDBC are:

  • Hibernate is database-independent.
  • b. No need to learn SQL.
  • c. There is no need for Query tuning in Hibernate.

4) What is first level cache in hibernate?

The first-level cache is also known as session level cache as it is always associated with session level objects. It minimizes database interaction by caching the object's state.

5) What is dirty checking in hibernate?

The dirty Checking concept is used to check and update the modification. It automatically modifies the updated fields without changing the remaining fields.

6) What is the criteria query in hibernate?

The Criteria Query is used to retrieve the records according to the specific criteria. It is basically a data retrieval technique.

7) How many layers are available in hibernate architecture?

The Hibernate architecture is consists of a total of four layers. The four layers are the java application layer, hibernate framework layer, backhand API layer, and database layer.

8) What does the session object hold in hibernate?

In Hibernate, the Session object holds the first level cache data.

9) What is the default annotation for a property in hibernate?

@Id annotation is the default annotation for a property in the java framework, it gives access to the features by placing the annotation on getter and setter methods.

10) Does Hibernate Session interface thread-safe in Java?

No, Hibernate session is not a thread-safe object It is required to manually manage transactions and sessions by developer

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

Python MCQ
Fortran MCQ