Hibernate/Hibernate Mcq Set 1 Sample Test,Sample questions

Question:
 If a single table hosts all the instances of a class hierarchy, then it is known as

1.Joined subclass strategy

2.Single table per class hierarchy strategy

3.Both

4.None of these


Question:
 To persist collections of embeddable type, hibernates uses

1.OneToMany

2. ElementCollection

3.Both A and B

4.None


Question:
 What does "" means?

1.generate primary key

2.generate tables based on configuration

3.generate sql statement on configuration

4.None of these


Question:
 Which of the following element maps java.util.Map property in hibernate?

1.<set>

2. <list>

3.<bag>

4. <map>


Question:
 Which of the following is not a Session method?

1.Session.save()

2.Session.remove()

3.Session.saveorupdate()

4.Session.persist()


Question:
 Which of the following is true about HQL?

1.Hibernate supports named parameters in its HQL queries.

2.HQL supports a range of aggregate methods, similar to SQL.

3.Both of the above.

4.None of the above.


Question:
 Which of the following is true about transient state of a persistent entity?

1.A new instance of a persistent class which is not associated with a Session

2.A new instance of a persistent class which has no representation in the database

3.A new instance of a persistent class which has no identifier value

4.All of the above


Question:
In the elements of Hibernate architecture is a factory of session and client of ConnectionProvider,It holds second level cache (optional) of data?

1.Connection Provider

2.Session

3.Session Factory

4.Transaction


Question:
In which file database table configuration is stored?

1..dbm

2..hbm

3..ora

4..sql


Question:
Select the design pattern that should be followed while creating SessionFactory in hibernate?

1. Singleton

2.Prototype

3.Both

4. None


Question:
Select the inheritance model which is NOT available in Hibernate

1.Tables Per Concrete Class

2.Table Per class hierarchy

3.Table Per sub-class

4.Table Per Object


Question:
The Hibernate XML configuration file name is?

1. hibernate.cfg.xml

2.hibernate.config.xml

3.hibernate.cg.xml

4. None of the mentioned


Question:
The QBC stands for

1.Query By Call

2.Query By Column

3.Query By Criteria

4.Query By Code


Question:
What does hibernate.hbm2ddl.auto create this means?

1.create tables automatically

2.create session object automatically

3.create Session Factory object automatically

4.None of these


Question:
Which method is easy for a Java programmer to add a criterion?

1.HCQL

2.HQL

3.SQL

4.None of the above


Question:
Which of the following are most common configuration methods of Hibernate Configuration

1.XML Configuration hibernate.cfg.xml

2.Mapping files and XML Configuration hibernate.cfg.xml

3.web.config

4.http.conf


Question:
Which of the following are tags of hibernate.cfg.xml?

1.SQL variant to generate

2. DTD

3.JDBC connection

4.All of these


Question:
Which of the following database is not supported by Hibernate?

1.Oracle

2.Microsoft SQL Server Database

3.FoundationDB

4.Informix Dynamic Server


Question:
Which of the following element is used to represent many-to-many relationship in hibernate?

1. <many-to-many>

2.<many-many>

3. <ManyToMany>

4.None of the above.


Question:
Which of the following elements is used to define specific mappings from a Java classes to the database tables?

1.property

2.hibernate-config

3. class

4. class-config


Question:
Which of the following is FALSE about Session in hibernate

1.Session is a lightweight non-threadsafe object

2.You can share the session between threads

3.Session represents a single unit-of-work with the database

4.Session is the primary interface for the persistence service


Question:
Which of the following is not a core component of Hibernate?

1.JDBC

2.SessionFactory

3.Session

4.Configuration


Question:
Which of the following is not a core interface of Hibernate?

1.Configuration

2. Criteria

3.SessionManagement

4.Session


Question:
Which of the following is not a state of object in Hibernate?

1.Attached()

2.Detached()

3.Persistent()

4. Transient()


Question:
Which of the following is not an advantage of Hibernate Criteria API?

1.Allows to use aggregate functions

2.Cannot order the result set

3.Allows to fetch only selected columns of result

4.Can add conditions while fetching results


Question:
Which of the following is not an advantage of using Hibernate Query Language?

1.Database independent

2. Easy to write query

3.No need to learn SQL

4.Difficult to implement


Question:
Which of the following is not an inheritance mapping strategies?

1.Table per hierarchy

2.Table per concrete class

3.Table per subclass

4.Table per class


Question:
Which of the following is true about detached state of a persistent entity?

1.Once we close the Hibernate Session, the persistent instance will become a detached instance.

2. A new instance of a persistent class which is not associated with a Session.

3. You can make a transient instance detached by associating it with a Session.

4.None of the above.


Question:
Which of the following is true about query level cache in hibernate?

1.Query level cache is an optional feature

2. Query level cache requires two additional physical cache regions that hold the cached query results and the timestamps when a table was last updated

3.Query level cache is only useful for queries that are run frequently with the same parameters

4.All of the above


Question:
Which of the following method is used inside session only?

1.merge()

2.update()

3.end()

4.kill()


Question:
Which of the following methods hits database always?

1.load()

2. loadDatabase()

3.getDatabase()

4.get()


Question:
Which of the following methods returns proxy object?

1. loadDatabase()

2.getDatabase()

3. load()

4. get()


Question:
Which statement is correct?

1.Only the Session that you obtained with sf.getCurrentSession() is flushed and closed automatically

2.Only the Session that you obtained with sf.openSession() is flushed and closed automatically

3.Only the Session that you obtained with sf.getNewSession() is flushed and closed automatically

4.None of the above


More MCQS

  1. Hibernate - Java (MCQ) questions and answers
  2. Hibernate Mcq Set 1
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!