0

databases Online Quiz - 201

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

It is possible to use Transactional control statements in Database Triggers?

  1. True

  2. False


Correct Option: B

Which of the following is not correct about Cursor ?

  1. Cursor is a named Private SQL area

  2. Cursor holds temporary results

  3. Cursor is used for retrieving multiple rows

  4. SQL uses implicit Cursors to retrieve rows


Correct Option: B

AI Explanation

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

Option A) Cursor is a named Private SQL area - This option is correct. A cursor is a named private SQL area that stores information about a specific SQL statement. It allows the database to process SQL statements and retrieve data in a controlled and efficient manner.

Option B) Cursor holds temporary results - This option is incorrect. Cursors do not hold temporary results. Instead, they hold the information needed to retrieve and process the results of a query.

Option C) Cursor is used for retrieving multiple rows - This option is correct. One of the main purposes of a cursor is to retrieve multiple rows of data from a result set. Cursors provide a way to fetch rows one by one or in batches, enabling the processing of large result sets.

Option D) SQL uses implicit Cursors to retrieve rows - This option is correct. SQL uses implicit cursors to retrieve rows. Implicit cursors are automatically created by the database management system (DBMS) when a SQL statement is executed. They are used to retrieve single rows or a small number of rows.

The correct answer is B) Cursor holds temporary results. This option is incorrect because cursors do not hold temporary results. Instead, they hold the information needed to retrieve and process the results of a query.

Which of the following is NOT VALID in PL/SQL ?

  1. Select … into

  2. Update

  3. Create

  4. Delete


Correct Option: C

A Transaction ends

  1. Only when it is Committed

  2. Only when it is Rolledback

  3. When it is Committed or Rolledback

  4. None of the above


Correct Option: C
Explanation:

To answer this question, users need to understand the concept of transaction management in the database.

A transaction is a sequence of operations performed on a database that must be treated as a single unit of work. It has four main properties - Atomicity, Consistency, Isolation, and Durability. In case, a transaction is not committed, it is rolled back, which means all changes made by the transaction are undone.

Now, let's go through each option:

A. Only when it is Committed: This option is incorrect because a transaction can end in two ways: by committing or by rolling back. If the transaction is committed, the changes made by it are made permanent in the database.

B. Only when it is Rolledback: This option is incorrect because a transaction can end either by committing or by rolling back. If a transaction is rolled back, the changes made by it are undone, and the database is restored to its original state before the transaction began.

C. When it is Committed or Rolledback: This option is correct because a transaction can either be committed or rolled back. Once a transaction is committed or rolled back, it gets over, and the database moves to the next transaction.

D. None of the above: This option is incorrect because, as explained above, a transaction ends either by committing or by rolling back.

Hence, the correct answer is:

The Answer is: C. When it is Committed or Rolledback.

Which command or action causes an automatic rollback?

  1. GRANT

  2. EXIT at pl/sql prompt

  3. Alter command

  4. System crash

  5. Commit before a system crash


Correct Option: D

If an UNIQUE KEY constraint on DATE column is created, it will accept the rows that are inserted with SYSDATE ?

  1. True

  2. False


Correct Option: B

Why is searching for large-table full-table scans critical to SQL tuning?

  1. They indicate an optimized execution plan.

  2. They may be able to be tuned to use an index

  3. The full-table scan should be normalized from the database design

  4. A full-table scan is always sub-optimal.


Correct Option: B

IDMS is a ______________ type of database

  1. Relational

  2. Hierarchical

  3. Network

  4. What is IDMS


Correct Option: C

What is IDMS?

  1. Intergrated Data Management System

  2. India Department of Management Studies

  3. International Data Management System

  4. Integrated Data Management Services


Correct Option: A

READY command is for _______

  1. VOLUME

  2. AREA

  3. RECORD

  4. PAGE


Correct Option: B

BIND is for ________

  1. AREA

  2. VOLUME

  3. PAGE

  4. RECORD


Correct Option: D

READY follows BIND (TRUE/FALSE)

  1. True

  2. False


Correct Option: A

Which of the following DB2 command can be used to change bob’s password?

  1. CHANGE PASSWORD USER bob OLD bobpass NEW newpass

  2. CONNECT TO sample USER bob USING bobpass NEW newpass

  3. CONNECT TO sample USER bob USING bobpass NEW newpass CONFIRM newpass

  4. No DB2 command can be used to change the password of a user ID


Correct Option: C

Which of the following privilege is required to create a new package in a database?

  1. CONTROL

  2. BIND

  3. EXECUTE

  4. BINDADD


Correct Option: D

Which of the following system catalog view contains the grantee information of the REFERENCE privilege on a view?

  1. SYSCAT.VIEWS

  2. SYSCAT.TABLES

  3. SYSCAT.TABAUTH

  4. SYSCAT.REFERENCES


Correct Option: C

Which of the following statement is true?

  1. a table is an ordered set of data records

  2. an index always accesses data in ascending order

  3. a view stores the data on a different tablespace

  4. an index can be used to enforce uniqueness in a table


Correct Option: D

CREATE DATABASE command creates some default table spaces. What are they? Choose all that apply.

  1. SYSLOGSPACE

  2. TEMPSPACE1

  3. USERSPACE1

  4. SYSCATSPACE


Correct Option: B,C,D

What keyword is used to define the number of pages that the database will write to one container before skipping to the next container?

  1. SKIPSIZE

  2. PREFETCHSIZE

  3. STRIPSIZE

  4. EXTENTSIZE


Correct Option: D

Examine the description of the EMPLOYEES table: EMP_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(30) NOT NULL FIRST_NAME VARCHAR2(30) DEPT_ID NUMBER(2) JOB_CAT VARCHARD2(30) SALARY NUMBER(8,2) Which statement shows the maximum salary paid in each job category of each department?

  1. SELECT dept_id, job_cat, MAX(salary) FROM employees WHERE salary > MAX(salary);

  2. SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id, job_cat;

  3. SELECT dept_id, job_cat, MAX(salary) FROM employees;

  4. SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id;


Correct Option: B

AI Explanation

To find the maximum salary paid in each job category of each department, we need to group the data by department and job category and then find the maximum salary within each group.

Let's go through each option to determine which one correctly achieves this:

Option A) SELECT dept_id, job_cat, MAX(salary) FROM employees WHERE salary > MAX(salary); This option is incorrect because the WHERE clause is comparing the salary to the maximum salary, which is not a valid comparison. Additionally, the MAX(salary) function cannot be used in the WHERE clause.

Option B) SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id, job_cat; This option is correct because it uses the GROUP BY clause to group the data by department and job category. It then uses the MAX(salary) function to find the maximum salary within each group.

Option C) SELECT dept_id, job_cat, MAX(salary) FROM employees; This option is incorrect because it does not include the GROUP BY clause, which is necessary to group the data by department and job category.

Option D) SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id; This option is incorrect because it only groups the data by department, but it does not include the job category in the grouping. We need to group by both department and job category to find the maximum salary in each job category of each department.

Therefore, the correct answer is Option B.

Examine the description of the STUDENTS table: STD_ID NUMBER(4) COURSE_ID VARCHARD2(10) START_DATE DATE END_DATE DATE Which two aggregate functions are valid on the START_DATE column? (Choose two)

  1. SUM(start_date)

  2. COUNT(start_date)

  3. AVG(start_date, end_date)

  4. MIN(start_date)


Correct Option: B,D

AI Explanation

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

Option A) SUM(start_date) - This option is incorrect because the SUM function is used to calculate the sum of numeric values. The START_DATE column is of the DATE data type, which is not a numeric data type.

Option B) COUNT(start_date) - This option is correct. The COUNT function is used to count the number of rows in a column. It can be used on any data type, including the DATE data type.

Option C) AVG(start_date, end_date) - This option is incorrect because the AVG function is used to calculate the average of numeric values. It cannot be used with multiple columns.

Option D) MIN(start_date) - This option is correct. The MIN function is used to find the minimum value in a column. It can be used on the DATE data type.

Therefore, the two valid aggregate functions on the START_DATE column are COUNT(start_date) and MIN(start_date).

The correct answer is B,D.

- Hide questions