Database (DBMS) Quiz 2

Description: Database (DBMS) Quiz 2
Number of Questions: 10
Created by:
Tags: database
Attempted 0/10 Correct 0 Score 0

You are managing the in-house database systems.You need to ensure that the user AMY can execute all operations against the SALES relation. What SQL statement sequence will you use?

  1. GRANT ALL PRIVILEGES WHERE FROM ON TO

  2. GRANT ALL PRIVILEGES TO WHERE FROM

  3. GRANT ALL PRIVILEGES WHERE FROM TO

  4. GRANT ALL PRIVILEGES ON TO

  5. GRANT ALL PRIVILEGES ON WHERE FROM


Correct Option: D

AI Explanation

To ensure that the user AMY can execute all operations against the SALES relation, you can use the following SQL statement sequence:

D. GRANT ALL PRIVILEGES ON SALES TO AMY

Explanation:

The GRANT statement is used to grant privileges to a user in a database system. In this case, the goal is to grant all privileges on the SALES relation to the user AMY.

The correct syntax for the GRANT statement is:

GRANT [privileges] ON [relation] TO [user]

In this case, we want to grant all privileges on the SALES relation to the user AMY. Therefore, the correct statement is:

GRANT ALL PRIVILEGES ON SALES TO AMY

Option D is the correct answer because it matches the correct syntax and grants all privileges on the SALES relation to the user AMY.

You run a SELECT statement, and multiple duplicates of values are retrieved. What keyword can you use to retrieve only the non duplicate data?

  1. DUBPLICATE

  2. INDIVIDUAL

  3. SEPARATE

  4. DISTINCT

  5. INDEX


Correct Option: D

Which of the following elements are the valid components of ACID in a relational database transaction?

  1. Atomicity

  2. Consistency

  3. Isolation

  4. Durability

  5. All of the above


Correct Option: E

In JDBC, what represents a single instance of a particular database session?

  1. a thread

  2. an opened connection

  3. a closed connection

  4. a pipe


Correct Option: B

What statement do you use to remove a schema and its related objects from your relational database?

  1. DROP SCHEMA CASCADE

  2. DROP SCHEMA RESTRICT

  3. DROP SCHEMA ALL

  4. DROP SCHEMA CLEAR

  5. DROP SCHEMA OPTS


Correct Option: A

In a properly designed DBMS, concurrency control is provided by which of the following components.

  1. Process Manager

  2. Cache Manager

  3. Transaction Manager

  4. Lock Manager

  5. C&D


Correct Option: E

Which of the following are valid CREATE statements in the world of DDL?

  1. CREATE SCHEMA

  2. CREATE TABLE

  3. CREATE DOMAIN

  4. CREATE INDEX

  5. All of the above


Correct Option: E

What statement do you use to remove a schema and ensure that the removal takes place only if the schema is empty?

  1. DROP SCHEMA RESTRICT

  2. DROP SCHEMA OPTS

  3. DROP SCHEMA CASCADE

  4. DROP SCHEMA CLEAR


Correct Option: A

What is used by a properly designed DBMS to enable databases to be returned to the pre-transaction state should errors occur?

  1. two phase commit

  2. prefetch transaction

  3. one phase commit

  4. backup and restore

  5. All of the above


Correct Option: A

AI Explanation

To answer this question, we need to understand the concept of error handling and recovery in a database management system (DBMS).

Option A) Two-phase commit - This option is incorrect. Two-phase commit is a protocol used to ensure the atomicity and consistency of distributed transactions. It does not specifically deal with error recovery.

Option B) Prefetch transaction - This option is incorrect. Prefetching is a technique used to improve the performance of data retrieval by fetching data in advance. It is not directly related to error recovery.

Option C) One-phase commit - This option is incorrect. One-phase commit is a protocol used to commit a transaction in a distributed system. It does not specifically deal with error recovery.

Option D) Backup and restore - This option is correct. Backup and restore is a commonly used technique in DBMS to enable databases to be returned to a previous state in case of errors or failures. Regular backups are taken to create a copy of the database, and in case of errors, the database can be restored from the backup.

Option E) All of the above - This option is incorrect as not all of the options listed (A, B, and C) are correct. Only option D, backup and restore, is correct.

The correct answer is D) backup and restore. This option is correct because a properly designed DBMS uses backup and restore techniques to enable databases to be returned to the pre-transaction state should errors occur.

Under JDBC, which of the following types of instances can be created by the Connection object?

  1. PreparedStatement

  2. CallableStatement

  3. Statement

  4. SQLStatement

  5. AB&C


Correct Option: E

AI Explanation

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

Option A) PreparedStatement - This option is correct. The Connection object in JDBC can create instances of PreparedStatement. PreparedStatement is used to execute parameterized SQL queries and provides better performance and security compared to Statement.

Option B) CallableStatement - This option is correct. The Connection object in JDBC can create instances of CallableStatement. CallableStatement is used to execute stored procedures in the database.

Option C) Statement - This option is correct. The Connection object in JDBC can create instances of Statement. Statement is used to execute simple SQL queries.

Option D) SQLStatement - This option is incorrect. SQLStatement is not a valid class or interface in JDBC.

Based on the explanations above, the correct answer is E) AB&C. The Connection object in JDBC can create instances of PreparedStatement, CallableStatement, and Statement.

- Hide questions