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.

In a scenario where a transaction involves multiple SQL queries, how should exceptions be handled to ensure that either all queries succeed or none do?

  • Commit each query individually
  • Commit the entire transaction only if all queries succeed
  • Ignore exceptions and continue with the transaction
  • Rollback the entire transaction on any exception
Handling exceptions in a transaction involving multiple SQL queries requires rolling back the entire transaction on any exception to ensure data consistency鈥攅ither all queries succeed, or none do.

Which method is used to batch multiple SQL statements before sending them to the database?

  • execute()
  • executeBatch()
  • executeQuery()
  • executeUpdate()
The executeBatch() method is used to batch multiple SQL statements together before sending them to the database, which can improve performance by reducing the number of round-trips.

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.

An ORM framework's ability to automatically generate SQL queries from object-oriented code is known as _________.

  • Auto-Generating
  • Caching
  • Lazy Loading
  • Mapping
The ability of an ORM framework to automatically generate SQL queries from object-oriented code is known as Auto-Generating, streamlining the process of interacting with databases using object-oriented code.