• Tutorials
  • Courses
  • Tracks

Advanced Java Quiz Day 52

Last Updated :
Discuss
Comments

Question 1

In Hibernate, what is the default fetching strategy for @OneToMany associations?


  • Eager Loading

  • Lazy Loading

  • Immediate Loading

  • Pre-fetch Loading

Question 2

Which statement is true about Eager Loading in Hibernate?

  • Data is loaded only when explicitly accessed

  • It can reduce initial load time for large datasets

  • All associated entities are fetched immediately along with the parent entity

  • It uses fetch="lazy" by default

Question 3

What is the scope of Hibernate’s First-Level Cache?

  • Application-wide

  • Session-wide

  • Transaction-wide

  • JVM-wide

Question 4

The Second-Level Cache in Hibernate:

  • Is enabled by default

  • Works at the session level only

  • Is shared across sessions

  • Cannot be used with clusters

Question 5

Which of the following is an example of a Hibernate Second-Level Cache provider?

  • Ehcache

  • ArrayList

  • ConcurrentHashMap

  • LinkedList

Question 6

Which method is used to remove a specific object from the First-Level Cache?

  • clear()

  • evict(Object entity)

  • refresh(Object entity)

  • detach(Object entity)

Question 7

Cache eviction in Hibernate means:

  • Removing unused objects from the database

  • Deleting entities permanently

  • Removing entities from cache memory

  • Rolling back transactions

Question 8

Which is true about HQL (Hibernate Query Language)?

  • It supports only native database syntax

  • It works with entity names and properties instead of table/column names

  • It can only perform SELECT operations

  • It always requires native SQL mappings

Question 9

Which of the following is not true about Native SQL in Hibernate?

  • It can execute database-specific queries

  • It bypasses Hibernate’s object mapping completely

  • It works with table and column names directly

  • It automatically uses Hibernate’s entity mappings in queries

There are 9 questions to complete.

Take a part in the ongoing discussion