How does the use of 'lazy loading' in an ORM framework like Hibernate affect database performance?

  • Decreases performance by loading all data at once
  • Depends on the specific use case
  • Has no impact on performance
  • Increases performance by loading data on demand
'Lazy loading' in Hibernate increases performance by loading data on demand, reducing the initial load time and resource consumption.

What are the implications of using optimistic vs. pessimistic locking strategies in database transactions?

  • Both have similar implications
  • Optimistic locking prevents blocking, may lead to conflicts
  • Pessimistic locking reduces contention, but can cause blocking
  • They are used interchangeably based on convenience
Optimistic locking in database transactions prevents blocking but may lead to conflicts, while pessimistic locking reduces contention but can cause blocking due to exclusive locks.

Explain the role of database indexing in query optimization.

  • Depends on the size of the database and data distribution
  • Has no impact on query optimization
  • Slows down queries by adding complexity
  • Speeds up data retrieval by providing faster access
Database indexing plays a crucial role in query optimization by speeding up data retrieval. Indexes provide faster access to specific data, reducing the time it takes to execute queries, especially in scenarios with large datasets.

Reducing the number of database ________ can significantly improve performance in a web application.

  • connections
  • indexes
  • queries
  • transactions
Reducing the number of repeated SQL queries can significantly improve performance in a web application.

_________ is a technique used to minimize the cost of repeatedly executing similar SQL queries.

  • Caching
  • Normalization
  • Sharding
  • Triggers
Caching is a technique used to minimize the cost of repeatedly executing similar SQL queries by storing the results of expensive operations and returning the cached result when the same operations occur.

How is an asynchronous task started in a servlet?

  • asyncTask.start()
  • beginAsync()
  • initAsync()
  • startAsync()
An asynchronous task in a servlet is started using the startAsync() method. This method initiates asynchronous processing and returns an AsyncContext for managing the asynchronous task.

How is a servlet configured in a web application?

The tag is used to define a servlet in the web.xml file. The element specifies the fully qualified name of the servlet class, providing the configuration necessary for the servlet container to manage the servlet.

The practice of breaking down a transaction into smaller parts to reduce locking is known as _________.

  • Batch Processing
  • Fragmentation
  • Isolation
  • Partitioning
The practice of breaking down a transaction into smaller parts to reduce locking is known as Batch Processing, where a transaction is divided into smaller batches to minimize the duration of locks and increase concurrency.

In database optimization, _________ refers to the process of storing frequently accessed data in a temporary storage area.

  • caching
  • indexing
  • locking
  • normalization
In database optimization, caching refers to the process of storing frequently accessed data in a temporary storage area, reducing the need to fetch it from the original source repeatedly.

_________ in JDBC helps in reusing the same connection for multiple database operations.

  • CallableStatement
  • Connection Pooling
  • PreparedStatement
  • ResultSet
Connection Pooling in JDBC helps in reusing the same connection for multiple database operations, enhancing efficiency and reducing the overhead of opening and closing connections repeatedly.