Computer Knowledge
Database Management Systems
5,344 Questions
Database Management Systems (DBMS) form the core framework for data storage, retrieval, and security in modern software applications. Concepts such as the E-R model, backup planning, SQL integration, and big data architecture are essential for computer knowledge sections. This hub offers a comprehensive set of practice questions to master DBMS fundamentals and advanced database operations.
E-R Model ConceptsBackup and RecoverySQL Server UpgradesJDBC and ODBCBig Data CharacteristicsData VirtualizationOracle Database
Database Management Systems Questions
-
Optimizer Index Caching
-
Optimizer Index Cost Adjustments
-
Optimizer Mode
-
Parallel Automatic Tuning
B
Correct answer
Explanation
Optimizer Index Cost Adjustments (OPTIMIZER_INDEX_COST_ADJ) parameter adjusts the cost of index access paths relative to full table scans. A value less than 100 makes indexes cheaper, encouraging index use; greater than 100 makes full table scans more attractive. The default of 100 treats them equally.
-
Automatic Maintenance Tasks(AMT)
-
Automatic Workload Repository(AWR)
-
Automatic Database Diagnostic Monitor(ADDM)
-
Automatic Storage Management(ASM)
B
Correct answer
Explanation
The Automatic Workload Repository (AWR) is the built-in repository in Oracle 10g and later that collects performance statistics at regular intervals (default 30 or 60 mins), replacing and expanding upon the functionality of STATSPACK.
-
Use of dynamic Query with System Privilege Account
-
Use of Prepared Statements
-
Use Least Privilege Account
-
Both 1 and 3
-
Both 2 and 3
E
Correct answer
Explanation
To prevent SQL injection and unauthorized access, best practices dictate using Prepared Statements (to parameterize queries) and using a Least Privilege Account (to limit potential damage).
-
View Helper
-
DAO
-
Service to Worker
-
Composite Entity
B
Correct answer
Explanation
Data Access Object (DAO) pattern abstracts and encapsulates access to a data source. It manages connections and provides CRUD operations while hiding the details of data persistence from the rest of the application. This separates business logic from data access logic.
-
Composite Entity
-
Service to Worker
-
Domain store
-
Value list handler
A
Correct answer
Explanation
Composite Entity is a J2EE pattern used to model, represent, and manage interrelated persistent objects as a coarse-grained entity rather than fine-grained beans. This reduces the number of actual calls and improves performance.
-
Use of dynamic Query with System Privilege Account
-
Use of Prepared Statements
-
Use Least Privilege Account
-
Both 1 and 3
-
Both 2 and 3
E
Correct answer
Explanation
Using prepared statements prevents SQL injection attacks by parameterizing queries. Using least privilege accounts limits potential damage from attacks by minimizing database permissions. Both are essential security practices.
-
a) StandardQueryCache and UpdateTimestampsCache
-
b) StandardQueryCache
-
c) QueryCache
-
d) QueryCache and TimestampsCache
A
Correct answer
Explanation
When hibernate.cache.use_query_cache is set to true, Hibernate enables two cache regions: StandardQueryCache (for caching query results) and UpdateTimestampsCache (for tracking when tables were last modified). This allows efficient query result caching while maintaining data consistency.
-
a) StandardQueryCache and UpdateTimestampsCache
-
b) StandardQueryCache
-
c) QueryCache
-
d) QueryCache and TimestampsCache
A
Correct answer
Explanation
When hibernate.cache.use_query_cache is set to true, Hibernate enables two cache regions: StandardQueryCache (for caching query results) and UpdateTimestampsCache (for tracking when tables were last modified). This allows efficient query result caching while maintaining data consistency.
-
a) lazy="true"
-
b) lazy="false"
-
c) lazy="on"
-
d) lazy="off"
A
Correct answer
Explanation
Batch fetching in Hibernate is specifically useful when lazy loading is enabled (lazy="true"). It allows Hibernate to load multiple lazy associations in batches rather than one at a time, reducing the number of database queries and improving performance.
-
a) lazy="true"
-
b) lazy="false"
-
c) lazy="on"
-
d) lazy="off"
A
Correct answer
Explanation
Batch fetching in Hibernate is specifically useful when lazy loading is enabled (lazy="true"). It allows Hibernate to load multiple lazy associations in batches rather than one at a time, reducing the number of database queries and improving performance.
-
a) NULL
-
b) Empty Object
-
c) unrecoverable exception
-
d) None of the above
C
Correct answer
Explanation
In Hibernate, session.load() returns a proxy object immediately without hitting the database. When you attempt to access a property on this proxy, if no matching row exists, it throws an unrecoverable ObjectNotFoundException.
-
a) a) controls how a particular SessionFactory interacts with the Data Base.
-
b) controls how a particular SessionFactory interacts with the second-level cache.
-
c) controls how a particular session interacts with the second-level cache.
-
d) None
C
Correct answer
Explanation
CacheMode controls how a particular Session interacts with the second-level cache. It determines whether the session should read from, write to, or interact with the second-level cache during operations like loading, saving, or updating entities.
-
a) Query.list()
-
b) Query.iterate()
-
c) Both are same
-
d) None of the above
A
Correct answer
Explanation
When instances are not in session or second-level cache, Query.list() performs better than Query.iterate(). Query.list() fetches all data in a single SQL query, while Query.iterate() first loads identifiers then loads each entity individually (N+1 queries problem), causing multiple database round-trips.
-
a) remove data from in memory
-
b) remove from database.
-
c) remove from sessionFactory
-
d) None of the above.
B
Correct answer
Explanation
The sess.delete() method in Hibernate removes the corresponding record from the database. It marks the entity for deletion and executes the DELETE SQL statement when the transaction is committed. It doesn't just remove from memory - it's a real database operation.
-
create tables automatically
-
b) create session object automatically
-
c) create Session Factory object automatically
-
d) None
A
Correct answer
Explanation
Setting hibernate.hbm2ddl.auto to create instructs Hibernate to automatically drop existing database tables and create new ones based on the entity mappings during application startup.