0% found this document useful (0 votes)
34 views

Unit 3 - QB

The document contains a question bank for the subject Database Management Systems. It has 24 multiple choice questions related to topics like Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Transaction Control Language (TCL), database constraints, aggregation functions and subqueries.

Uploaded by

mbisen5422
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Unit 3 - QB

The document contains a question bank for the subject Database Management Systems. It has 24 multiple choice questions related to topics like Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Transaction Control Language (TCL), database constraints, aggregation functions and subqueries.

Uploaded by

mbisen5422
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

Ramapuram Campus, Bharathi Salai, Ramapuram, Chennai - 600089

FACULTY OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OFCOMPUTER SCIENCE AND ENGINEERING

QUESTIONBANK

Degree & Branch : B.TECH- CSE


Semester & Year : : IV/II
Sub Code & Subject Name : 21CSC205P- Database Management Systems
Regulation : 2021

Academic Year : 2023-2024


SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
Ramapuram Campus, Bharathi Salai, Ramapuram, Chennai-600089

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

QUESTION BANK

SUBJECT : Subject Code: 21CSC205P - Database Management Systems

SEM/YEAR: VI/III
Course Outcomes
CO3: Implement the database Structure with SQL
Q. Course Competence
Questions Outcome BT Level
No.
Full form of DDL is –

A. Data Describe Language


B. Definition Data Language
1 CO3 BT1
C. Data Definition Language
D. Data Distinct Language

Commands that comes under DDL is/are –

A. CREATE
B. DROP
2 BT2
C. TRUNCATE CO3
D. All of the above

Full form of DML is –

A. Data Multiplication Language


B. Data MaLanguagenipulation
3 BT1
C. Data Modify Language CO3
D. Data Mapping Language

Command that comes under DML is/are –

A. ROLLBACK
B. GRANT CO3
4 BT1
C. UPDATE
D. All of the above
Select the correct statement.

A. With the DDL commands, any structural changes can be


made to the table, including creation, deletion, and
alteration.
B. With the DML commands, any structural changes can be
made to the table, including creation, deletion, and
alteration.
5 CO3 BT1
C. With the DCL commands, any structural changes can be
made to the table, including creation, deletion, and
alteration.
D. With the TCL commands, any structural changes can be
made to the table, including creation, deletion, and
alteration.

Full form of DCL is -

A. Data Control Language


B. Data Commit Language CO3
6 BT1
C. Data Common Language
D. Data Concatenate Language

Full form of TCL is -

A. Transaction Common Language


B. Transaction Commit Language CO3
7 BT2
C. Transaction Concatenate Language
D. Transaction Control Language

What is TRUE about SAVEPOINT?

A. Following the completion of a transaction, it must be


executed to save all the operations performed in the
transaction. CO3
8 BT3
B. A transaction can be rolled back to its last saved state.
C. A specific part of a transaction can be given a name
D. None of the above
Following the completion of a transaction, it must be
executed to save all the operations performed in the
transaction. Here we are talking about which command?

A. REVOKE
9 CO3 BT1
B. COMMIT
C. ROLLBACK
D. SAVE

Difference between GRAND & REVOKE command is/are?

A. The GRANT command can be used to grant a user access


to databases and tables whereas The REVOKE command
can be used to revoke all access privileges already
assigned to the user.
B. The REVOKE command can be used to grant a user CO3
10 BT1
access to databases and tables whereas The GRANT
command can be used to revoke all access privileges
already assigned to the user.
C. A transaction can be rolled back to its last saved state.
D. None of the above

The table records can be retrieved using which command?

A. RETRIEVE
B. SELECT CO3
11 BT1
C. CREATE
D. ALTER

Which command will remove the records from the table, but
not affect the structure of the table?

A. REMOVE
12 B. DELETE CO3 BT2
C. DROP
D. TRUNCATE
The records and structure of a table may be removed or
deleted from the database using which command?

A. REMOVE
13 B. DELETE CO3 BT1
C. DROP
D. TRUNCATE

1. Constraints regarding integrity are ___ that must be


followed.

A. Data
CO3
14 B. Rules BT1

C. Tables

D. None

CO3
Which of the following is TRUE about TCL?

A. Transactions can be saved to the database and rolled back


with the help of TCL commands in SQL.
B. There will be certain privileges that each user has;
consequently, the data can be accessed by them using
15 TCL. BT1
C. Our data is stored in a table that is described by the
schema, thus TCL commands deal with the schema.
D. SQL TCL commands can be used to perform any kind of
retrieval or manipulation of the data present in SQL
tables.

A ___ constraint ensures that insertions, updates, and


other processes are performed in a manner that does
not compromise ___.

A. Data Composition
16 CO3 BT1
B. Data Interval

C. Data Integrity

D. Data Insertion
____ value is returned by the SQL Aggregate functions?

A. Single
B. Twice
17 CO3 BT1
C. NULL
D. Infinite

What does AVG() function returns? CO3

A. First value of the column


B. Last value of the column
18 BT1
C. Sum of rows of the table
D. Average value of the column

Which function returns the largest value of the column? CO3

A. MIN()
B. MAX()
19 BT1
C. LARGE()
D. AVG()

. Data constraint that expresses how many entities are CO3


related through a relationship set is referred to as a
___.

A. Data Constraint
20 BT1
B. Relationship Constraint

C. Entity Constraint

D. Mapping Constraint
What is TRUE about NOT NULL Constraint?

A. In columns that are subject to the NOT NULL constraint,


duplicate values are not allowed.
B. When a table's column is declared as NOT NULL, no
record in the table can have an empty value for that
column.
C. By applying the NOT NULL constraint, we will always BT1
21 CO3
ensure that the column contains a unique value and won't
allow nulls.
D. The value will first be checked for certain conditions
before inserting it into the column when a NOT NULL
constraint applies to a column in the table.

You can also _______ the existing tables by using the CO3
UNIQUE constraint.

A. Change
22 B. Delete BT1
C. Modify
D. Drop

A Sub query is an SQL expression that is placed ________ CO3


another SQL statement.

A. Before
23 B. After BT1
C. Inside
D. Outside

Which of the following clause cannot be used in SQL sub CO3


queries?

A. GROUP BY
24 B. ORDER BY BT1
C. DELETE
D. FROM
In order to prevent multiple records from being returned CO3
by the sub query, _______ must be used before the sub
query.

A. Many Value Operators


25 BT1
B. Multiple Value Operators
C. Single Value Operator
D. Unique Value Operator

Which of the following exception is globally available?

A. Internal, User-defined and Pre-defined exceptions


26 B. Pre-defined exceptions only CO3 BT1
C. Internal and pre-defined exceptions
D. User defined exceptions only

Where are exceptions used in PL/SQL?

A. Only in an anonymous block


B. Only in the body of a subprogram
27 CO3 BT1
C. Only in a package
D. Only in an anonymous block and the body of a
subprogram

Which of the following function gives the error code of the

recently occurred exception?

A. SQLERRCODE
28 CO3 BT1
B. SQLERROR
C. ERRCODE
D. SQLCODE
Can the PL/SQL block process more than one exception at a

time?

29 A. Yes CO3 BT1


B. No
C. Depends upon

What is the output for SELECT SAL INTO V_SAL FROM

EMP;

A. All rows selected


30 B. First record only printed CO3 BT1
C. Error as “exact fetch returns more than requested number
of rows”
D. All columns selected

Point out the correct statement.


A) Triggers are database object
B) Three types of triggers are present in SQL Server
31 C) A DDL trigger is an action programmed to execute when a CO3 BT1
data manipulation language (DML) event occurs in the database
server
D) ) Two types of triggers are present in SQL Server
How many types of triggers are present in SQL Server?
a) 4
32 b) 5 CO3 BT1
c) 8
d) 9
AFTER trigger in SQL Server can be applied to
_________________
a) Table
33 CO3 BT1
b) Views
c) Table and Views
d) Function
Which of the following is not a limitation of view?
a) ORDER BY Does Not Work
34 b) Index Created on View Used Often CO3 BT1
c) Cross Database Queries Not Allowed in Indexed View
d) Adding Column is Expensive by Joining Table Outside View
Point out the wrong statement.
a) We can have an INSTEAD OF insert/update/delete trigger
on a table that successfully executed
b) DML Triggers are used to evaluate data after data
35 CO3 BT1
manipulation using DML statements
c) INSTEAD OF triggers cause their source DML operation to
skip
d) AFTER triggers cause their source DML operation to skip
SQL Server allows for Transact-SQL stored procedures, triggers,
and batches to refer to tables that don't exist at compile time.
This ability is called?

36 A. Indeferred Name Resolution CO3 BT3


B. Deferred Name Permissions
C. Deferred Name Resolution
D. Indeferred Name Permissions

Temporary stored procedures are stored in _________


database.
a) Master
37 CO3 BT3
b) Model
c) User specific
d) Tempdb

What command use to see the errors from a recently created

stored procedure?

A. SHOW MISTAKES;
38 CO3 BT2
B. DISPLAY MISTAKES;
C. DISPLAY ERRORS;
D. SHOW ERRORS;

In the PL/SQL, the package specification contains


....................... declarations.

A) Public
39 CO3 BT2
B) Private

C) Friend

D) Protected
....................... contain a pointer that keeps track of current row
being accessed, which enables your program to process the
rows at a time.

A) Tracker
40 CO3 BT2
B) Cursor

C) Accesser

D) Trigger
................. provide a way for your program to select multiple
rows of data from the database and then process each row
individually.

A) PL/SQL Cursors
41 CO3 BT2
B) PL/SQL Trigger

C) PL/SQL Select

D) PL/SQL Process
Which option in view is to ensure that all UPDATE and
INSERTs satisfy the condition(s) in the view definition?

42 A. Uncheck CO3 BT3


B. With Check
C. Check
D. With

_______ views help to keep the database up-to-date.

A. View materialization
43 B. View isolation CO3 BT3
C. View updating
D. View maintenance

Temporary stored procedures are stored in _________ database.


a) Master
44 b) Model CO3 BT2
c) User specific
d) Tempdb
Which of the following exception raised when an arithmetic,
conversion, truncation, or size constraint error occurs?

A. ZERO_DIVIDE
45 CO3 BT2
B. VALUE_ERROR
C. TOO_MANY_ROWS
D. SELF_IS_NULL

Which of the following statements accurately describes an


INNER JOIN in SQL?

A) Returns only matching rows from both tables.

B) Returns all rows from both tables, with non-matching rows


46 filled with NULL values. CO3 BT3

C) Returns all rows from the left table and matching rows
from the right table.

D) Returns all rows from the right table and matching rows
from the left table.
When creating a function, in which section will you typically
find a return key word?

A. Header Only
47 CO3 BT3
B. Declarative
C. Executable and Header
D. Executable and exception handling

Which JOIN type is suitable for returning all rows from both
tables, regardless of whether they have matching rows in the
other table?

A) INNER JOIN
48 CO3 BT2
B) LEFT JOIN

C) RIGHT JOIN

D) FULL OUTER JOIN


The variables in the triggers are declared using
a) –
49 b) @ CO3 BT2
c) /
d) /@
Triggers ________ enabled or disabled
a) Can be
50 b) Cannot be CO4 BT3
c) Ought to be
d) Always
PART B (4 Marks)

What is SQL?
SQL is a database language designed for the retrieval and management of data in a
relational database.
1 CO3 BT1
SQL is the standard language for database management. All the RDBMS systems
like MySQL, MS Access, Oracle, Sybase, Postgres, and SQL Server use SQL as
their standard database language. SQL programming language uses various
commands for different operations. We will learn about the like DCL, TCL, DQL,
DDL and DML commands in SQL with examples.

What is DDL?
Data Definition Language helps you to define the database structure or schema.
Let’s learn about DDL commands with syntax.

CREATE
2 CO3 BT1
DROP

ALTER

TRUNCATE:

What is Data Manipulation Language?


Data Manipulation Language (DML) allows you to modify the database instance
by inserting, modifying, and deleting its data. It is responsible for performing all
types of data modification in a database.

3 There are three basic constructs which allow database program and user to enter CO3 BT1
data and information are:

Here are some important DML commands in SQL:

● INSERT
● UPDATE
● DELETE
What is DCL?
DCL (Data Control Language) includes commands like GRANT and REVOKE,
which are useful to give “rights & permissions.” Other permission controls
parameters of the database system.
4 BT2
Examples of DCL commands: CO3

Commands that come under DCL:

● Grant
● Revoke

Explain the concept of a subquery in DBMS. What is its purpose, and how
does it differ from a regular query?

A subquery, also known as a nested query or inner query, is a query nested within
another SQL statement, such as SELECT, INSERT, UPDATE, or DELETE. The
purpose of a subquery is to allow for more complex and dynamic data retrieval or
manipulation by performing a query within the context of another query.

The primary difference between a regular query and a subquery lies in their usage
5 and context within SQL statements: BT1
CO3
1. Purpose and Context:

2. Result Usage:

3. Data Dependency:

4. Complexity and Nesting:


What are SQL Constraints?
SQL Constraints are used to specify the rules for the data in a table.
These are used to limit which type of data must be stored in the
database, and aims to increase the accuracy and reliability of the data
stored in the database.

So, constraints make sure that there is no violation in terms of a


transaction of the data, yet there is any violation found; the action
6 BT2
gets terminated. CO3

There are two types of constraints which can be applied:

1. Column-level constraints – These constraints are applied to


a single column
2. Table-level constraints – These constraints are the
application to the complete table

Discuss the advantages and disadvantages of using triggers in a database


system.

Advantages:

1. Data Integrity Enforcement


2. Business Rule Enforcement
3. Automatic Audit Trail
4. Cascade Actions
5. Complex Data Transformation
6. Event-Driven Processing
7 CO3 BT2

Disadvantages:

1. Hidden Logic
2. Performance Overhead
3. Debugging Complexity
4. Concurrency Issues
5. Dependency Management
6. Security Risks
List out Scalar functions:
These functions are based on user input; these too returns single
value.

1. UCASE ()
2. LCASE ()
8 3. MID () BT2
4. LEN () CO3
5. ROUND ()
6. NOW ()
7. FORMAT ()

Write about trigger.


A trigger is a special type of stored procedure that
automatically runs when an event occurs in the database server.
9 DML triggers run when a user tries to modify data through a data CO3 BT1
manipulation language (DML) event.
DML events are INSERT, UPDATE, or DELETE statements on a
table or view.
Write an example for nested queries.
A nested query is a query that has another query embedded within it.
The embedded query is called a subquery.
A subquery typically appears within the WHERE clause of a query.
It can sometimes appear in the FROM clause or HAVING clause.
Let’s learn about nested queries with the help of an example.
10 CO3 BT1
Find the names of employee who have regno=103
The query is as follows −

select E.ename from employee E where E.eid IN (select S.eid from


salary S where S.regno=103);

what are the transaction control language commands?


 COMMIT. This command is used to make a transaction
permanent in a database.
11 CO3 BT2
 ROLLBACK.
 SAVEPOINT.

PART C (12 Marks)


1 Discuss the components of a trigger in PL/SQL and their significance. CO3 BT2
2 Explain in detail about constraints. CO3 BT2
Explain the concept of joins in DBMS. What are the different types CO3
3 BT2
of joins, and how are they used in SQL queries? Provide examples.
4 Explain in detail about Sub Queries, correlated sub queries CO3 BT2
5 Explain in detail about Nested Queries, Views and its Types CO3 BT2
How do you handle exceptions related to cursors in PL/SQL?
6 CO3 BT2
Discuss error handling techniques.
Explain the concept of set operations in DBMS. What are the
7 fundamental set operations supported in SQL, and how do they CO3 BT1
manipulate data sets?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy