0

databases Online Quiz - 177

Description: databases Online Quiz - 177
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0

Which one is not the output of the LOAD utility

  1. Loaded table or partition

  2. Discard file of rejected records

  3. Summary report of errors encountered

  4. Updated system catalog table stats


Correct Option: D
Explanation:

To answer this question, the user needs to be familiar with the LOAD utility in database systems.

The LOAD utility is used to load data from external files into database tables. It is commonly used for bulk inserts of large amounts of data.

Now, let's go through each option to determine which one is not an output of the LOAD utility:

A. Loaded table or partition: This is a valid output of the LOAD utility. When the LOAD utility is successful, it loads data from external files into database tables or partitions.

B. Discard file of rejected records: This is a valid output of the LOAD utility. When the LOAD utility encounters records that cannot be loaded into the target table or partition, it writes those records to a discard file.

C. Summary report of errors encountered: This is a valid output of the LOAD utility. When the LOAD utility encounters errors while loading data, it generates a summary report of those errors.

D. Updated system catalog table stats: This is not an output of the LOAD utility. The LOAD utility is used for inserting data into tables, not updating system catalog table stats. The job of updating system catalog statistics falls under the responsibility of the database management system.

Therefore, the answer is:

The Answer is: D

  1. UNLOAD TABLE DSN1DB04.EMPTABSP

  2. UNLOAD TABLESPACE DSN1DB04.EMPTABSP

  3. UNLOAD DATABASE DSN1DB04.EMPTABSP

  4. UNLOAD DATABASE DSN1DB04 EMPTABSP


Correct Option: B
  1. True

  2. False


Correct Option: A
Explanation:

The correct answer is A) True.

When data is loaded into a database, indexes can be automatically built on the specified columns. Indexes help improve query performance by allowing the database engine to quickly locate the rows that satisfy the search criteria. By automatically building indexes during the loading process, the database system can optimize the performance of queries executed on the loaded data.

Therefore, the statement that indexes are built automatically during loading is true.

  1. a table is unloaded

  2. a table is loaded

  3. an index is created

  4. a table is reorganized


Correct Option: A
Explanation:

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) A table is unloaded - This option is correct. When a table is unloaded, there is no need to use RUNSTATS. Unloading a table means that the data is being removed from the table, and therefore, there is no data to collect statistics on.

Option B) A table is loaded - This option is incorrect. When a table is loaded, it is recommended to use RUNSTATS to collect statistics on the newly loaded data. This helps the database optimizer make better decisions when generating query plans.

Option C) An index is created - This option is incorrect. When an index is created, it is recommended to use RUNSTATS to collect statistics on the indexed columns. This helps the database optimizer make better decisions when using the index in query plans.

Option D) A table is reorganized - This option is incorrect. When a table is reorganized, it is recommended to use RUNSTATS to collect statistics on the reorganized table. This helps the database optimizer make better decisions when generating query plans for the reorganized table.

The correct answer is A) a table is unloaded. This option is correct because there is no need to use RUNSTATS when a table is unloaded, as there is no data to collect statistics on.

Therefore, the correct answer is option A.

Which utility should be used for maintaining referential integrity between two tables

  1. LOAD

  2. CHECK

  3. REORG

  4. RUNSTATS


Correct Option: B

AI Explanation

To maintain referential integrity between two tables, the utility that should be used is the CHECK utility.

Option A) LOAD - The LOAD utility is used to load data into a table. While it is important to load data accurately, it does not specifically address maintaining referential integrity between tables.

Option B) CHECK - The CHECK utility is used to verify the integrity of the data and relationships between tables. It can be used to enforce referential integrity by checking that foreign key values in one table match the primary key values in another table.

Option C) REORG - The REORG utility is used to reorganize data within a table to improve performance. While it can help maintain the overall health of the database, it does not specifically focus on referential integrity between tables.

Option D) RUNSTATS - The RUNSTATS utility is used to collect statistics about table and index data. These statistics are used by the database optimizer to choose the most efficient access paths for queries. While it is important for query optimization, it does not specifically address referential integrity.

The correct answer is B) CHECK, as it is specifically designed to verify referential integrity and relationships between tables.

Which utility should be used to obtain the access paths details?

  1. QUIESCE

  2. EXPLAIN

  3. REORG

  4. RUNSTATS


Correct Option: B
Explanation:

To answer this question, the user needs to have a basic understanding of database management systems and utilities used to manage databases.

QUIESCE is a utility used to temporarily halt the activity on the database, allowing for maintenance operations to take place. It is not used to obtain access path details.

EXPLAIN is a utility used to display the access path details for a particular SQL statement. This option is correct.

REORG is a utility used to reorganize the physical storage of a database table, and is not used to obtain access path details.

RUNSTATS is a utility used to collect statistical information about the data contained in a database table, and is not used to obtain access path details.

Therefore, the correct answer is:

The Answer is: B. EXPLAIN

To create a trigger you need the following option

  1. Triggering Table

  2. Triggering Event

  3. Triggered Action

  4. All the above


Correct Option: D

AI Explanation

To create a trigger, you need all of the following options:

A. Triggering Table - This is the table on which the trigger will be created. The trigger will be executed whenever a certain event occurs on this table.

B. Triggering Event - This is the event that will trigger the execution of the trigger. Examples of triggering events include INSERT, UPDATE, or DELETE operations on the triggering table.

C. Triggered Action - This is the action that will be performed when the trigger is executed. The triggered action can be a set of SQL statements or a call to a stored procedure.

Therefore, the correct answer is D) All the above, as all of these options are necessary components for creating a trigger.

Triggers can not be used for

  1. Validate input data

  2. Automatically generate values for newly inserted rows

  3. support alerts

  4. To Implement Referential Integrity


Correct Option: D

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Validate input data - This option is incorrect. Triggers can be used to validate input data. Triggers can be set to execute before or after an insert, update, or delete operation and can be used to enforce data validation rules.

Option B) Automatically generate values for newly inserted rows - This option is incorrect. Triggers can be used to automatically generate values for newly inserted rows. For example, a trigger can be set to insert a default value into a specific column when a new row is inserted.

Option C) Support alerts - This option is incorrect. Triggers can be used to support alerts. For example, a trigger can be set to send an alert or notification when a specific condition is met.

Option D) To implement Referential Integrity - This option is correct. Triggers cannot be used to implement referential integrity. Referential integrity is typically enforced through foreign key constraints and not through triggers.

The correct answer is D) To implement Referential Integrity. This option is correct because triggers are not used to implement referential integrity. Referential integrity is enforced through foreign key constraints.

Choose the correct options on acquiring locks

  1. If transaction A holds X lock on row R, If transaction B requests for S lock, then B would go into wait state until A releases the lock

  2. If transaction A holds S lock on row R, If transaction B requests for S lock, then B would be granted the lock

  3. If transaction A holds X lock on row R, If transaction B requests for X lock,then B would be granted the lock.

  4. If transaction A holds S lock on row R, If transaction B requests for X lock, then B would be granted the lock


Correct Option: A,B

AI Explanation

To answer this question, you need to understand the concept of locks in the context of transaction management. Let's go through each option to understand why it is correct or incorrect:

Option A) If transaction A holds X lock on row R, If transaction B requests for S lock, then B would go into a wait state until A releases the lock. This option is correct because in most concurrency control protocols, if a transaction holds an exclusive (X) lock on a resource (row R in this case), other transactions requesting shared (S) locks will be put into a wait state until the exclusive lock is released. This ensures that only one transaction at a time can have exclusive access to a resource.

Option B) If transaction A holds S lock on row R, If transaction B requests for S lock, then B would be granted the lock. This option is correct because shared (S) locks are compatible with other shared locks. If a transaction holds a shared lock on a resource, other transactions requesting shared locks on the same resource can be granted the lock. This allows multiple transactions to access the resource simultaneously.

Option C) If transaction A holds X lock on row R, If transaction B requests for X lock, then B would be granted the lock. This option is incorrect because exclusive (X) locks are not compatible with other exclusive locks. If a transaction holds an exclusive lock on a resource, other transactions requesting exclusive locks on the same resource will have to wait until the lock is released.

Option D) If transaction A holds S lock on row R, If transaction B requests for X lock, then B would be granted the lock. This option is incorrect because exclusive (X) locks are not compatible with shared (S) locks. If a transaction holds a shared lock on a resource, other transactions requesting exclusive locks on the same resource will have to wait until the shared lock is released.

The correct answers are A and B. These options correctly describe the behavior of locks in a transactional system.

Choose the correct options on LOCKSIZE

  1. Database

  2. Tablespace

  3. Table

  4. View


Correct Option: B,C

AI Explanation

To answer this question, you need to understand the concept of LOCKSIZE in the context of databases. LOCKSIZE determines the level at which locks are acquired and released during data modification operations.

Let's go through each option to understand why it is correct or incorrect:

Option A) Database - This option is incorrect because LOCKSIZE is not applicable at the database level. LOCKSIZE is set at a more granular level, such as tablespace, table, or view.

Option B) Tablespace - This option is correct because LOCKSIZE can be set at the tablespace level. By specifying the LOCKSIZE at the tablespace level, you can control how locks are acquired and released for tables within that tablespace.

Option C) Table - This option is correct because LOCKSIZE can also be set at the table level. By specifying the LOCKSIZE at the table level, you can control how locks are acquired and released for that particular table.

Option D) View - This option is incorrect because LOCKSIZE is not applicable at the view level. LOCKSIZE is typically associated with physical data structures like tablespace or table.

The correct answer is B and C. These options are correct because LOCKSIZE can be set at the tablespace and table levels to control how locks are acquired and released during data modification operations.

Referential constraint is

  1. Designates the values that columns of a table can contain

  2. The limiting of a set of foreign key values to a set of primary key values

  3. The limiting of a set of Primary key values to a set of foreign key values

  4. None of the above


Correct Option: B

When acquiring Tablespace lock more data is restricted than page level Lock (True or False)

  1. True

  2. False


Correct Option: A
Explanation:

A tablespace lock is the most restrictive type of lock in DB2. It prevents any other process from accessing any data in the tablespace. A page lock only prevents other processes from accessing the specific page that is locked.

Therefore, the statement "When acquiring Tablespace lock more data is restricted than page level Lock" is True.

A tablespace lock restricts access to all of the data in a tablespace, while a page lock only restricts access to a single page. This means that a tablespace lock is more restrictive than a page lock.

For example, if a tablespace contains 100 pages and a process acquires a tablespace lock on the tablespace, then no other process can access any of the data in the tablespace, even if the data is not on the page that is locked. However, if a process acquires a page lock on a single page in the tablespace, then other processes can still access the data on the other 99 pages in the tablespace.

In general, tablespace locks should only be used when it is absolutely necessary to prevent other processes from accessing any data in the tablespace. Page locks should be used whenever possible, as they provide a more granular level of locking and allow other processes to access more data.

  1. True

  2. False


Correct Option: B
Explanation:

A system catalog is a group of tables and views that incorporate important information about a database. It includes tables that contain information about schemas, tables, columns, users, and so forth. A database management system (DBMS) typically manages these system catalog tables, and they are used to maintain consistent and reliable database operations.

While it's technically possible to create triggers on regular tables in a database, system catalog tables are typically not allowed to have triggers. The system catalog tables are managed by the DBMS itself, and any modifications to these tables are tightly controlled to avoid inconsistency or corruption of the system catalog. Therefore, DBMSs usually restrict users from creating triggers on system catalog tables.

Let's go through each option to understand why it is correct or incorrect:

Option A) True - This option is incorrect because system catalog tables are managed by the DBMS, and it typically prevents users from creating triggers on these tables.

Option B) False - This option is correct because, as mentioned above, creating triggers on system catalog tables is usually not allowed.

The correct answer is B) False. This option is correct because creating triggers on system catalog tables is typically not permitted by the DBMS to prevent potential data inconsistencies or system corruption.

- Hide questions