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

DBMS Basic Sheet

Uploaded by

vajid371ak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

DBMS Basic Sheet

Uploaded by

vajid371ak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

Structured Query Language

Q1. Suppose we have a relation declared by:


CREATE TABLE R
(
Name VARCHAR (50) PRIMARY KEY,
Salary INT CHECK (salary <= 40000)
);
Initially, the relation has three records:

We try to execute the following sequence of modifications.


(1) INSERT INTO R VALUES ('Fred', 12000);
(2) UPDATE R SET salary = 50000 WHERE name = 'Sue';
(3) INSERT INTO R VALUES (‘Tom’, 13000);
(4) DELETE FROM R WHERE name = 'Joe';
At the end of these statements, the sum of the salaries over all the tuples in R is:
(a) 52,000 (b) 62,000
(c) 65,000 (d) 72,000

Q2. Here are three table declarations for P(A), Q(B) and R(C) with referential integrity in SQL.
Create table P (A primary key);
Create table Q (B primary key references P(A) on update cascade);
Create table R (C primary key references Q(B) on update cascade);
Initial contents of the tables are as following:
P(A) = {(1), (2), (3), (4), (5), (6)};
Q(B) = {(1), (2), (4), (6);
R(C) = {(1), (2), (6)};
Let suppose we run following modification command:
Update P set A = A+10 WHERE A<5;
What will be the output of following query assuming any referential integrity actions?
SELECT sum(C) FROM R;
(a) 39 (b) 29
(c) 19 (d) 9

BASIC DATABASE MANAGEMENT SYSTEM Page 1


Q3. Consider the following CREATE TABLE definition:
CREATE TABLE Midterm( A INT NOT NULL, B INT NOT NULL, C INT NOT
NULL,PRIMARY KEY (A), FOREIGN KEY (B) REFERENCES Midterm(A) ON
DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (C) REFERENCES
Midterm(A) ON DELETE CASCADE ON UPDATE RESTRICT)
Consider the following instance table Midterm:

What is the result of the following statement?


UPDATE Midterm SET B = B+1 WHERE B in (SELECT A FROM Midterm)
(a) Query will run successfully and update the value of B
(b) Error because foreign key constraint is violated
(c) Error because primary key constraint is violated
(d) Syntax error in query

Q4. Here are declarations of two relations R and S:


CREATE TABLE S(C INT PRIMARY KEY, D INT);
CREATE TABLE R(A INT PRIMARY KEY, B INT FOREGIN KEY REFERENCES S(C)
);
R(A, B) currently contains the four tuples (0, 4), (1, 5), (2, 4), and (3, 5). S(C, D) currently
contains the four tuples (2, 10), (3, 11), (4, 12), and (5, 13). As a result, certain insertions and
deletions on R and S are illegal. Which of the following modifications will not violate any
constraint?
(a) Inserting (3, 3) into S. (b) Deleting (1, 5) from R.
(c) Deleting (4, 12) from S. (d) Inserting (5, 12) into S.

Q5. Consider the declarations of two relations R and S:


CREATE TABLE S(C INT PRIMARY KEY, D INT);
CREATE TABLE R(A INT PRIMARY KEY, B INT, CHECK(B IN (SELECT C FROM
S)));
R(A, B) currently contains the four tuples (0, 4), (1, 5), (2, 4), and (3, 5). S(C, D) currently
contains the four tuples (2, 10), (3, 11), (4, 12), and (5, 13). As a result, certain insertions and
deletions on S are illegal, as are certain updates or insertions on R. Which of the following
modifications will not be rejected because of a constraint violation?
(a) Inserting (5, 2) into R. (b) Inserting (4, 6) into R.
(c) Updating (0, 4) in R to be (0,0). (d) Inserting (1, 4) into R.

BASIC DATABASE MANAGEMENT SYSTEM Page 2


Data for the next twenty questions. Consider the following EMP and DEPT table form an
organization
EMP Table
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 1993-06-13 800.00 0.00 20
7499 ALLEN SALESMAN 7698 1998-08-15 1600.00 300.00 30
7521 WARD SALESMAN 7698 1996-03-26 1250.00 500.00 30
7566 JONES MANAGER 7839 1995-10-31 2975.00 20
7698 BLAKE MANAGER 7839 1992-06-11 2850.00 30
7782 CLARK MANAGER 7839 1993-05-14 2450.00 10
7788 SCOTT ANALYST 7566 1996-03-05 3000.00 20
7839 KING PRESIDENT 1990-06-09 5000.00 0.00 10
7844 TURNER SALESMAN 7698 1995-06-04 1500.00 0.00 30
7876 ADAMS CLERK 7788 1999-06-04 1100.00 20
7900 JAMES CLERK 7698 2000-06-23 950.00 30
7934 MILLER CLERK 7782 2000-01-21 1300.00 10
7902 FORD ANALYST 7566 1997-12-05 3000.00 20
7654 MARTIN SALESMAN 7698 1998-12-05 1250.00 1400.00 30
DEPT Table
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
Where the EMPNOis the key for EMP table, DEPTNOis the key for DEPT table, and DEPTNOis the
foreign key for EMPtable referencing DEPT table.
Q6. What is the output of the following query on given database?
SELECT ENAME, SAL FROM EMP WHERE SAL > (SELECT SAL FROM EMP WHERE
EMPNO = 7876);
(a) (b) (c) (d)
ENAME SAL
ENAME SAL ENAME SAL ENAME SAL
SMITH 800 KING 5000
ADAMS 1100 KING 5000
JAMES 950 BLAKE 2850
BLAKE 2850
CLARK 2450
CLARK 2450 JONES 2975
JONES 2975 SCOTT 3000
SCOTT 3000 FORD 3000
FORD 3000 ALLEN 1600
ALLEN 1600 WARD 1250
MARTIN 1250
WARD 1250
TURNER 1500
MARTIN 1250 MILLER 1300
TURNER 1500
ADAMS 1100
MILLER 1300

BASIC DATABASE MANAGEMENT SYSTEM Page 3


Q7. What is the output of the following query on given database?
SELECT ENAME FROM EMP WHERE SAL > (SELECT AVG(SAL) FROM EMP);
(a) (b) (c) (d)

Q8. What is the output of the following query on given database?


SELECT ENAME, DEPTNO FROM EMPWHERE SAL > ALL(SELECT SAL FROM
EMPWHERE DEPTNO = 20);
(a) (b) (c) (d)

Q9. What is the output of the following query on given database?


SELECT A.ENAME FROM EMP A, EMP B WHERE A.DEPTNO = B.DEPTNO AND
B.ENAME ='SCOTT';
(a) (b) (c) (d)

Q10. What is the output of the following query on given database?


SELECT ENAME, JOB FROM EMP WHERE EMPNO NOT IN (SELECT MGR FROM EMP
WHERE MGR IS NOT NULL);
(a) (b) (c) (d)
Blank output

BASIC DATABASE MANAGEMENT SYSTEM Page 4


Q11. What is the output of the following query on given database?
SELECT ENAME FROM EMP WHERE ENAME LIKE '%R%N%';
(a) (b) (c) (d)
Blank output

Q12. How many tuples are returned by following query on given database? _____
SELECT ENAME, DEPTNO FROM EMPWHERE SAL < ANY (SELECT SALFROM EMP
WHERE DEPTNO = 20)

Q13. How many tuples are returned by following query on database?____


SELECT ENAME , DEPTNO FROM EMPWHERE SAL > ALL (SELECT SALFROM
EMPWHERE DEPTNO = 50)

Q14. How many tuples are returned from the following query on given database? _______
SELECT ENAME FROM EMP WHERE ENAME LIKE '%A%' AND ENAME NOT LIKE
'%A%A%';

Q15. How many tuples are returned from the following query on given database? ___________
SELECT EMPNO, ENAME FROM EMP WHERE DEPTNO IN(SELECT DEPTNO FROM EMP
WHERE ENAME LIKE '%T%');

Q16. How many tuples are returned from the following query on given database? ___________
SELECT EMPNO, ENAME, SAL FROM EMP WHERE SAL > (SELECT AVG (SAL) FROM
EMP) AND DEPTNO IN ( SELECT DEPTNO FROM EMP WHERE ENAME LIKE '%T%');

Q17. How many tuples are returned from the following query on given database? ___________
SELECT EMPNO,ENAME,JOB,HIREDATE FROM EMP WHERE HIREDATE BETWEEN
‘1995-10-30' AND '1998-10-30' ORDER BY(EMPNO);

Q18. How many tuples are returned from the following query on given database? ___________
SELECT DISTINCT(JOB) FROM EMP WHERE SAL BETWEEN 1500 AND 4000;

Q19. How many tuples are returned from the following query on given database? ___________
SELECT ENAME,SAL FROM EMP WHERE SAL NOT BETWEEN 1500 AND 2850;

Q20. How many tuples are returned from the following query on given database? ___________
SELECT ENAME,DEPTNO FROM EMP WHERE (DEPTNO=10 OR DEPTNO=30) ORDER
BY(ENAME);

BASIC DATABASE MANAGEMENT SYSTEM Page 5


Q21. How many tuples are returned from the following query on given database? ___________
SELECT ENAME FROM EMP WHERE (ENAME LIKE '%R%R' OR ENAME LIKE '%A%A')
AND (DEPTNO=30 OR MGR=7788);

Q22. How many tuples are returned from the following query on given database? ___________
SELECT ENAME,JOB,SAL FROM EMP WHERE (JOB='CLERK' OR JOB='ANALYST')
AND (SAL NOT IN (1000,3000,5000));

Q23. How many tuples are returned from the following query on given database? ___________
SELECT * FROM EMP WHERE MGR IS NOT NULL AND COMM IS NULL;

Q24. How many tuples are returned from the following query on given database? ___________
SELECT ENAME, HIREDATE FROM EMPWHERE DEPTNO = (SELECT DEPTNO FROM
EMP WHERE ENAME = 'BLAKE') AND ENAME <> 'BLAKE';

Q25. How many tuples are returned from the following query on given database? ___________
SELECT * FROM EMP WHERE COMM IS NULL AND JOB NOT
IN('CLERK','MANAGER') AND HIREDATE LIKE '%30' AND SAL>1500;

Data for next five questions, consider the following definition of tables and snapshot of the tables:
Definition of tables:
CREATE TABLE CUSTOMER (CID INT, NAME VARCHAR2(20), AGE INT, CITY
VARCHAR2(20), STATE VARCHAR2(20), PRIMARY KEY (CID));

CREATE TABLE RESERVE (CID INT, TITLE VARCHAR2(20), R_DATE VARCHAR2(20),


FOREIGN KEY (CID) REFERENCES CUSTOMER (CID));
Snapshot of the tables:

Q26. Consider the following relational query on the above database:


SELECT * FROM Customer C JOIN Reserve R USING (Cid)
The numbers of rows that will be returned by the above SQL query is___________

BASIC DATABASE MANAGEMENT SYSTEM Page 6


Q27. Consider the following relational query on the above database:
SELECT DISTINCT Title FROM Customer C, Reserve R WHERE C.cid = R.cid
AND C.city = 'Bhopal'
The numbers of rows that will be returned by the above SQL query is___________
Q28. Consider the following relational query on the above database:
SELECT * FROM Customer C LEFT OUTER JOIN Reserve R ON C.cid = R.cid
The numbers of rows that will be returned by the above SQL query is____________

Q29. Consider the following relational query on the above database:


SELECT * FROM Customer C FULL OUTER JOIN Reserve R ON C.cid = R.cid
The numbers of rows that will be returned by the above SQL query is______________

Q30. Consider the following relational query on the above database:


SELECT Title, COUNT(*) FROM Customer C, Reserve R WHERE C.cid =
R.cid GROUP BY title
The numbers of rows that will be returned by the above SQL query is__________

Data for next five questions, consider the following snapshot of the database:

The sid is the key for Suppliers, pid is the key for Parts, and sid and pid together form the key for Catalog.
SID is the foreign key for Catalog referencing Suppliers table and PID is the foreign key for Catalog
referencing Parts table. The Catalog relation lists the prices charged for parts by Suppliers. Answer the
following questions.
Q31. Consider the following relational query on the above database:
SELECT MIN(C.cost) FROM Catalog C, Parts P WHERE C.pid = P.pid
AND P.color = 'Red';
Which one of the following is the correct interpretation of the above query?
(a) Find the price of the most expensive red part.
(b) Find the price of the least expensive part
(c) Find the price of the most expensive part
(d) Find the price of the least expensive red part.

BASIC DATABASE MANAGEMENT SYSTEM Page 7


Q32. Consider the following relational query on the above database:
SELECT DISTINCT P.pname FROM Parts P, Catalog C WHERE P.pid = C.pid;
Which one of the following is the correct interpretation of the above query?
(a) Find the pnames of parts for which there is some supplier.
(b) Find the pnames of parts for which there is no supplier.
(c) Find the distinct pnames of parts who is supplied by the every supplier.
(d) Find the distinct pnames of parts for which there is some supplier.

Q33. Consider the following relational query on the above database:


SELECT S.sname FROM Suppliers S, Parts P, Catalog C WHERE P.color =
'RED' AND C.pid = P.pid AND C.sid = S.sid;
Which one of the following is the correct interpretation of the above query?
(a) Find the names of suppliers who supply some red parts.
(b) Find the names of suppliers who supply only red parts.
(c) Find the names of suppliers who supply every red part.
(d) Find the names of suppliers who supply all parts.

Q34. Consider the following relational query on the above database:


SELECT C.sid, FROM Catalog C, Parts P
WHERE (P.color = 'RED' OR P.color = 'GREEN') AND P.pid = C.pid;
Which one of the following is the correct interpretation of the above query?
(a) Find the sids of suppliers who supply some red or green part.
(b) Find the sids of suppliers who supply every red or green part.
(c) Find the sids of suppliers who supply every red part or supply every green part.
(d) Find the sids of suppliers who supply every red part and supply every green part.

Q35. Consider the following relational query on the above database:


SELECT S.sid, S.sname FROM Suppliers S, Catalog C, Parts P
WHERE S.sid = C.sid AND P.pid = C.pid
AND P.color = 'RED' GROUP BY S.sid, S.sname
HAVING COUNT(*) = (SELECT COUNT(*) FROM Parts P1
WHERE P1.color = 'RED');
Which one of the following is the correct interpretation of the above query?
(a) Find the names of suppliers who supply some red parts.
(b) Find the names of suppliers who supply only red parts.
(c) Find the names of suppliers who supply every red part.
(d) Find the names of suppliers who supply all parts.

BASIC DATABASE MANAGEMENT SYSTEM Page 8


For next five questions, consider the following snapshot of the database.

The EMP_ID is the primary key for Employee, DEPT_NO is the primary key for Department, and
DEPT_ID is the foreign key for Employee referencing DEPT_NO in Department table.
Q36. Which of following query display the name of the employees who gets more salary than the
employee with ID 7700.
(a) SELECT Emp_Name FROM Employee
WHERE salary > (SELECT salary FROM Employee
WHERE Emp_ID = 7700);
(b) SELECT Emp_Name FROM Employee e1
WHERE salary > (SELECT salary FROM Employee e2
WHERE Emp_ID = 7700 AND e2.salary > e1.salary);
(c) SELECT Emp_Name FROM Employee e1
WHERE e1.Emp_ID = 7700 AND EXISTS(SELECT * FROM Employee e2 WHERE
e2.salary > e1.salary);
(d) Both a and c

Q37. [MSQ]
Which of following query is/are display the name, salary, department id, job for the employees
who works in the same designation as the employee with id is 7566.
(a) SELECT Emp_Name, Salary, Dept_id, job FROM Employee
WHERE Job = (SELECT job FROM Employee WHERE Emp_ID = 7566);
(b) SELECT Emp_Name, Salary, Dept_id, job FROM Employee e
WHERE EXISTS (SELECT * FROM Employee e1 WHERE e1.Emp_ID = 7566
AND e.job = e1.job);

BASIC DATABASE MANAGEMENT SYSTEM Page 9


(c) SELECT e.Emp_Name, e.Salary, e.Dept_id, e.job
FROM Employee e NATURAL JOIN (SELECT job FROM Employee WHERE
Emp_ID = 7566) AS EMP;
(d) None of these.

Q38. [MSQ]
Which of following query display the name, salary, department id for the employees who earn
the salary equal to smallest salary of any of the departments?
(a) SELECT e.Emp_Name, e.Salary, e.Dept_id, e.job
FROM Employee e WHERE salary = (SELECT MIN(MIN(salary))
FROM Employee GROUP BY dept_id);
(b) SELECT e.Emp_Name, e.Salary, e.Dept_id, e.job FROM Employee e
WHERE salary IN (SELECT MIN(salary) FROM Employee
GROUP BY dept_id);
(c) SELECT e.Emp_Name, e.Salary, e.Dept_id, e.job FROM Employee e
WHERE salary = ANY (SELECT MIN(salary) FROM Employee
GROUP BY dept_id);
(d) None of these.
Q39. [MSQ]
Which of following query display the employee id, employee name for all employees who earn
more than the average salary of organization?
(a) SELECT Emp_ID, Emp_Name FROM Employee WHERE salary >
AVG(salary);
(b) SELECT Emp_ID, Emp_Name FROM Employee
WHERE salary > (SELECT AVG(salary) as AVG FROM employee);
(c) SELECT Emp_ID, Emp_Name
FROM Employee, (SELECT AVG(salary) as AVG FROM employee)
WHERE salary > AVG;
(d) None of these.

Q40. Which of following query display the employee name, employee id and salary of all employees
who report to BLAKE?
(a) SELECT Emp_ID, Emp_Name, Salary FROM Employee
WHERE Emp_Name = 'BLAKE';
(b) SELECT Emp_ID, Emp_Name, Salary FROM Employee
WHERE Emp_ID = (SELECT Mang_ID FROM Employee
WHERE Emp_Name = 'BLAKE');

BASIC DATABASE MANAGEMENT SYSTEM Page 10


(c) SELECT Emp_ID, Emp_Name, Salary FROM Employee
WHERE Mang_ID = (SELECT Emp_ID FROM Employee
WHERE Emp_Name = 'BLAKE');
(d) SELECT Emp_ID, Emp_Name, Salary FROM Employee
WHERE Emp_ID = (SELECT Emp_ID FROM Employee
WHERE Emp_Name = 'BLAKE');

For the next ten questions, consider the reference (snapshot) of database. There are six tables in
database describing a company, describing employees, departments, buildings, which department(s)
an employee works in (and a percentage of the time for each), department managers (possibly more
than one per department), and in which building an employee works (an employee may have more
than one office). The primary key of EMP table is EID, DEPT table is DID, BUILDING table is BID,
IN_DEPT table is (EID, DID), IN_BUILDING table is (EID, BID), and MANAGES_DEPT table
is (EID, DID). Other attributes in the tables are not necessarily unique.

Q41. Which of the following queries finds the names of buildings and building number where more
than 50 employees work?
1. SELECT BID, Bname FROM BUILDING WHERE BID IN (SELECT BID FROM
In_Building GROUP BY BID HAVING Count(*) > 50)
2. SELECT B.BID, Bname FROM Building B, In_Building I
WHERE B.BID = I.BID GROUP BY B.BID HAVING Count(*) > 50

BASIC DATABASE MANAGEMENT SYSTEM Page 11


3. SELECT BID, Bname FROM Building B WHERE 50 < (SELECT Count(*)
FROM In_Building I WHERE I.BID = B.BID)
(a) 3 only (b) 1 and 3 only (c) 2 only (d) All the above

Q42. Which of the following queries finds the name of Departments where no employees work?
1. SELECT Dname FROM Dept WHERE DID IN (SELECT I.DID FROM In_Dept
I GROUP BY I.DID HAVING COUNT(*) = 0)
2. SELECT Dname FROM Dept WHERE DID NOT IN (SELECT DISTINCT DID
FROM In_Dept I)
3. SELECT Dname FROM Dept D WHERE NOT EXISTS (SELECT * FROM
In_Dept I, EMP WHERE I.EID = EMP.EID and I.DID = D.DID)
(a) 1 and 3 only (b) 2 and 3 only (c) 2 only (d) All the above

Q43. [MSQ]
Which of the following queries finds the name of the Department(s) where the highest paid
employee works?
(a) SELECT D.Dname FROM Dept D WHERE D.DID IN (SELECT T.DID,
MAX(Salary) FROM Dept T, In_Dept I, Emp E WHERE T.DID = I.DID and
E.EID = I.EID)
(b) SELECT DName FROM Dept D, In_Dept I, Emp E WHERE D.DID = I.DID
and E.EID = I.EID and E.Salary>= ALL (SELECT Salary FROM EMP)
(c) SELECT DName FROM Dept WHERE DID IN (SELECT I.DID FROM In_Dept I,
Emp E WHERE I.EID = E.EID AND Salary = (SELECT MAX(Salary) FROM
Emp))
(d) None of the above.

Q44. Which of the following query find the name of employees who works in building where josh
is working?
(a) SELECT Ename FROM EMP WHERE EID IN (SELECT EID FROM IN_BUILDING
WHERE BID IN (SELECT BID FROM EMP,IN_BUILDING WHERE Ename =
'Josh'));
(b) SELECT Ename FROM EMP WHERE EID NOT IN (SELECT EID FROM
IN_BUILDING WHERE BID IN (SELECT BID FROM EMP,IN_BUILDING WHERE
ENAME='Josh' and EMP.EID=IN_BUILDING.EID));
(c) SELECT Ename FROM EMP WHERE EID IN (SELECT EID FROM IN_BUILDING
WHERE BID IN (SELECT BID FROM EMP,IN_BUILDING WHERE Ename = 'Josh'
AND P.EID = IN_BUILDING.EID));

BASIC DATABASE MANAGEMENT SYSTEM Page 12


(d) SELECT Ename FROM EMP WHERE EID IN (SELECT EID FROM IN_BUILDING
WHERE BID IN (SELECT BID FROM EMP,IN_DEPT WHERE Ename = 'Josh'
AND EMP.EID=IN_DEPT.EID));

Q45. Which of the following query find the total number of employee are working 100% in either
development or sales department?
(a) SELECT SUM(EID) FROM EMP, MANAGES_DEPT, IN_DEPT
WHERE EMP.EID = IN_DEPT.EID = MANAGES_DEPT.EID
AND Dname IN (‘Development’, ‘Sales’)
AND Percent_time = 100
(b) SELECT COUNT (*) FROM IN_DEPT WHERE Percent_time = 100
AND DID IN (SELECT DID FROM DEPT WHERE Dname = 'Sales'
OR Dname = 'Development')
(c) SELECT COUNT(EID) FROM (SELECT EID FROM EMP, DEPT, MANAGES_DEPT
WHERE EMP.EID = MANAGES_DEPT.EID AND MANAGES_DEPT.DID =
DEPT.DID AND Percent_ time = 100)
(d) SELECT COUNT(*) FROM (SELECT EName FROM EMP, IN_DEPT
WHERE EMP.EID = IN_DEPT.EID AND Percent_ time = 100
AND IN_DEPT.DID IN (SELECT DID FROM DEPT WHERE
EMP.EID = MANAGES_DEPT.EID AND DEPT.DID = MANAGES_DEPT.DID))

Q46. Which of the following query find name of employees with department drawing highest salary
in their department?
(a) SELECT EName FROM EMP WHERE Salary NOT IN (SELECT MAX(Salary)
FROM (SELECT * FROM EMP E, IN_DEPT I WHERE E.EID = I.EID));
(b) SELECT EName FROM EMP WHERE Salary IN (SELECT MAX(Salary) FROM
(SELECT * FROM EMP E, IN_DEPT I WHERE E.EID = I.EID));
(c) SELECT Ename FROM EMP WHERE Salary IN (SELECT MAX(Salary) FROM
(SELECT * FROM EMP E, IN_DEPT I WHERE E.EID=I.EID) GROUP BY DID);
(d) SELECT EName FROM EMP WHERE Salary NOT IN (SELECT MIN(Salary)
FROM (SELECT * FROM EMP E, IN_DEPT I WHERE E.EID=I.EID) GROUP BY
DID);

BASIC DATABASE MANAGEMENT SYSTEM Page 13


Q47. [MSQ]
Which of the following queries find the name of employee who works in more than one
department?
(a) SELECT E.EName FROM EMP E INNER JOIN IN_DEPT D ON E.EID = D.EID
GROUP BY E.EID HAVING COUNT(DID) >= 2
(b) SELECT E.EID, E.EName FROM EMP WHERE E.EID IN (SELECT D.EID FROM
IN_DEPT D GROUP BY D.EID HAVING COUNT(DID) >= 2)
(c) SELECT E.EName FROM EMP E, IN_DEPT D WHERE E.EID = D.EID GROUP
BY E.EID, E.EName HAVING COUNT(DID) >= 2
(d) None of the above

Q48. Which of the following query get the department name and number of employees in the
department?
(a) SELECT DName, COUNT(*) FROM DEPT D INNER JOIN EMP E ON E.DID =
D.DID GROUP BY D.DID, DName;
(b) SELECT DName, COUNT(*) FROM DEPT D INNER JOIN IN_DEPT I ON D.DID
= I.DID GROUP BY D.DID, DName;
(c) SELECT DName, COUNT(*) FROM DEPT D, IN_DEPT I WHERE D.DID = I.DID
GROUP BY D.DID, DName;
(d) Both (b) and (c)

Q49. [MSQ]
Which of the following queries in SQL find the names of departments where more than two
employees are working?
(a) SELECT DName FROM DEPT D, IN_DEPT I WHERE D.DID = I.DID GROUP BY
D.DID, DName HAVING COUNT (*) > 2;
(b) SELECT DName FROM DEPT D, IN_DEPT I WHERE D.DID = I.DID AND COUNT
(*) > 2 GROUP BY D.DID, DName;
(c) SELECT DName FROM DEPT WHERE DID NOT IN (SELECT DID FROM IN_DEPT
GROUP BY DID HAVING COUNT(*) <= 2);
(d) SELECT DName FROM DEPT D WHERE EXIST(select * from IN_DEPT I
where I.DID =D.DID Group by I.DID having(count(*)>2);

BASIC DATABASE MANAGEMENT SYSTEM Page 14


Q50. Which of the following query returns the name of building having highest number of employee
from a department?
(a) SELECT BNAME FROM BUILDING, IN_BUILDING, IN_DEPT WHERE
IN_BUILDING.BID = BUILDING.BID AND IN_BUILDING.EID =
IN_DEPT.EID AND DID = (SELECT DID FROM (SELECT DID, COUNT(*) AS
NOE FROM IN_DEPT, EMP GROUP BY DID))
(b) SELECT BNAME FROM BUILDING, IN_BUILDING, EMP WHERE BUILDING.BID
IN_BUILDING.BID = BUILDING.BID AND IN_BUILDING.EID = EMP.EID
AND MAX(COUNT(EID))
(c) SELECT BNAME FROM BUILDING, IN_BUILDING, EMP WHERE BUILDING.BID
IN_BUILDING.BID= BUILDING.BID AND IN_BUILDING.EID = EMP.EID AND
MAX (SELECT COUNT(*) FROM EMP, IN_DEPT GROUP BY EID)
(d) None of the above

For next ten questions, consider the following relation table and their schemas, where primary keys
are underlined.

BASIC DATABASE MANAGEMENT SYSTEM Page 15


BASIC DATABASE MANAGEMENT SYSTEM Page 16
Q51. What will this query return?
SELECT C_Name, Count(b.C_ID) AS NOB FROM Book b, Category c
WHERE b.C_ID = c.C_ID GROUP BY c.C_Name ORDER BY NOB;
(a) It will return name of the category and the count of books in each category in ascending
order.
(b) It will return name of the category and the count of books in each category in descending
order.
(c) It will return name of the category and the count of books in each category in random order.
(d) None of the above
Q52. Which of the following queries will display title of all the books not rated by any reviewer?
(a) SELECT Book_Title FROM Book, Ratings WHERE Book.ISBN NOT IN
(SELECT Ratings.ISBN FROM Reviewer);
(b) SELECT Book_Title FROM Book WHERE ISBN NOT IN(SELECT ISBN FROM
Ratings);
(c) SELECT Book_Title FROM Book b WHERE NOT EXISTS (SELECT * FROM
Ratings r where r.ISBN = b.ISBN);
(a) I and II only (b) II and III only (c) I and III only (d) II only
Q53. Which of the following query will display authors who have reviewed their own book
themselves and given 5 stars to their books?
(a) SELECT Book_Author FROM Book, Ratings, Reviewer
WHERE Reviewer.R_ID = Ratings.R_ID
AND Reviewer.R_Name = Book.Book_Author
AND Ratings.Rating = 5;
(b) SELECT Book_Author, Book.ISBN, Ratings.rating FROM Book, Ratings,
Reviewer WHERE Reviewer.R_ID = Ratings.R_ID
AND Book.ISBN = Ratings.ISBN
AND Reviewer.R_Name = Book.Book_Author
AND Ratings.rating = 5;
(c) SELECT Book_Author FROM Reviewer, Book, Ratings
WHERE Book_Author IS NOT NULL
AND Reviewer.R_Name = Book.Book_Author
AND Ratings.rating = 5;
(d) SELECT Book_Author
FROM (Reviewer NATURAL JOIN Ratings) NATURAL JOIN Book
WHERE Book_Author IS NOT NULL
AND Reviewer.R_Name = Book.Book_Author
AND Ratings.rating = 5;

BASIC DATABASE MANAGEMENT SYSTEM Page 17


Q54. Which of the following query will display the publisher whose book doesn’t get any review?
S1: SELECT P_Name FROM Publisher WHERE P_ID IN(SELECT P_ID FROM Book
WHERE ISBN NOT IN (SELECT ISBN FROM Ratings));
S2: SELECT P_Name FROM Publisher WHERE P_ID IN(SELECT P_ID FROM Book
b WHERE NOT EXISTS (SELECT * FROM Ratings r where r.ISBN = b.ISBN));
(a) S1 will display but S2 will not display
(b) S2 will display but S1 will not display
(c) Both S1 and S2 will display
(d) Both S1 and S2 will not display

Q55. [MSQ]
Which of the following query(s) will display List of all the publishers and their respective books
in ascending order of publisher name and title?
(a) Q1:SELECT P_Name, Book_Title FROM Book B, Publisher P
WHERE B.P_ID(+) = P.P_ID ORDER BY P.P_Name, Book_Title;
(b) Q2:SELECT P_Name, Book_Title FROM Book b RIGHT OUTER JOIN
Publisher P ON B.P_ID = P.P_ID ORDER BY P.P_Name, Book_Title;
(c) Q3:SELECT P_Name, Book_Title FROM Book B, Publisher P
WHERE B.P_ID = P.P_ID(+) ORDER BY P.P_Name, Book_Title;
(d) Q4: SELECT P_Name, Book_Title FROM Book B, Publisher P where
P_Pid=B_Pid order by P.P_Name, B.Book_Title;

Q56. Which of the following query(s) will display name of book that has the maximum number of
pages?
Q1:SELECT Book_Title FROM Book
WHERE Num_Of_Pages IN (SELECT MAX(Num_Of_Pages) FROM Book);
Q2:SELECT Distinct Book_Title FROM Book b1
WHERE NOT EXISTS (SELECT * FROM Book b2
WHERE b2.Num_of_Pages < b1.Num_of_Pages);
Q3:SELECT Distinct Book_Title FROM Book b1
WHERE NOT EXISTS (SELECT * FROM Book b2
WHERE b2.Num_of_Pages > b1.Num_of_Pages);
(a) Q1 and Q2 only
(b) Q2 and Q3 only
(c) Q1 and Q3 only
(d) All of the above

BASIC DATABASE MANAGEMENT SYSTEM Page 18


Q57. Which of the following query will display the name of authors and count of book title who have
written at least 2 books?
(a) SELECT Book_Author, COUNT(Book_Title) AS Book_Count FROM Book
GROUP BY Book_Author HAVING Book_Count>= 2;
(b) SELECT Book_Author, COUNT(Book_Title) FROM Book GROUP BY
Book_Author HAVING COUNT(Book_Title) >= 2;
(c) SELECT Book_Author, COUNT(Book_Title) FROM Book GROUP BY
Book_Author WHERE COUNT(Book_Title) >= 2;
(d) Both a and b

Q58. [MSQ]
Which of the following query will display the name of books that has more pages than the
average of the number of pages of all books?
(a) SELECT Book_Title FROM Book WHERE Num_of_Pages> (SELECT
SUM(Num_of_Pages)/Count(Num_of_Pages) FROM Book);
(b) SELECT Book_Title FROM Book WHERE Num_of_Pages>
AVG(Num_of_Pages);
(c) SELECT Book_Title FROM Book WHERE Num_of_Pages> (SELECT
AVG(Num_of_Pages) FROM Book);
(d) None of these

Q59. Which of the following query will display the name of author and number of books who has
written highest number of books?
Q1:SELECT Book_Author, number_books
FROM (SELECT Book_Author, COUNT(Book_Title) AS number_books
FROM Book GROUP BY Book_Author) A
WHERE A.number_books = (SELECT MAX(number_books) FROM A));
Q2: SELECT Book_Author, COUNT(Book_Title) AS number_books
FROM Book GROUP BY Book_Author
HAVING number_books>= ALL( SELECT COUNT(Book_Title)
FROM Book GROUP BY Author)
(a) Q1 only
(b) Q2 only
(c) Both Q1 and Q2
(d) None of these

BASIC DATABASE MANAGEMENT SYSTEM Page 19


Q60. What is the output of the following query?
SELECT ISBN, Book_Title FROM Book WHERE ISBN IN (SELECT b.ISBN FROM
Book b, Reading r WHERE b.ISBN = r.ISBN GROUP BY b.ISBN HAVING
Count(b.ISBN) >=3)

Data for next five questions, consider the following snapshot of relation table and their schemas,
where primary keys are underlined.

BASIC DATABASE MANAGEMENT SYSTEM Page 20


Q61. What will this query return
SELECT custname FROM customer c, borrower b, loan l
WHERE b.loanno = l.loanno AND c.custno = b.custno
AND branchno = (SELECT branchno FROM branch
WHERE branchname = 'Perryridge')
(a) It will return the name of the customer who has taken loan form perryridge branch
(b) It will return the name of customer who has deposited the loan amount in the perryridge
branch
(c) It will return the name of customer of the perryridge branch
(d) None of the above
Q62. Which of the following queries return the name, account number, and balance of all customers
who have an account with a balance of 1000 or less?
S1: SELECT custname, accno, balance
FROM Customer NATURAL JOIN account
WHERE balance <= 1000;
S2: CREATE VIEW ACCBALANCE AS
SELECT custno, accno, balance FROM account
WHERE balance <= 1000;
SELECT custname, accno, balance
FROM Customer NATURAL JOIN ACCBALANCE;
S3: WITH ACCBAL AS ( SELECT custno, accno, balance
FROM account WHERE balance <= 1000)
SELECT custname, accno, balance
FROM Customer NATURAL JOIN ACCBAL;
(a) S1 and S2 only (b) S1 and S3 only
(c) S2 and S3 only (d) All the above

BASIC DATABASE MANAGEMENT SYSTEM Page 21


Q63. Which of the following queries display all the account number where balance is less than 1000
and have loan more than or equal to 500?
S1: SELECT accno FROM Account WHERE balance < 1000
AND branchno IN (SELECT branchno FROM Loan WHERE amount >= 500);
S2: SELECT accno FROM Account NATURAL JOIN loan
WHERE balance < 1000 AND amount >= 500;
S3: SELECT accno FROM Account, (SELECT branchno FROM Loan
WHERE amount >= 500) Amount WHERE balance < 1000
AND Amount.branchno = Account.branchno
(a) S1 and S2 only (b) S1 and S3 only
(c) S2 and S3 only (d) All the above
Q64. What will this query return
SELECT custname FROM customer c, account a, branch b
WHERE b.branchname = 'Redwood' AND c.custno = a.custno
AND a.branchno = b.branchno AND c. custno
IN(SELECT custno FROM account MINUS SELECT custno FROM Borrower);
(a) It will display name of all customers who hold an account at redwood branch but has not
borrowed loan from it.
(b) It will display name of all customers who hold an account at redwood branch and has
borrowed loan from it.
(c) It will display name of all customers who doesn’t hold an account at redwood branch but
has borrowed loan from it.
(d) None of the above

Q65. Which of the following query return the name of customers who has joint account?
(a) SELECT custname FROM customer c, account GROUP BY Accno
HAVING Count(Custno)>=2;
(b) SELECT custname FROM customer c, account a
WHERE a.custno = c.custno AND a.accno
IN(SELECT accno FROM Account WHERE COUNT(custno)>= 2
GROUP BY Accno);
(c) SELECT custname FROM customer c, account a
WHERE a.custno = c.custno AND a.accno IN(SELECT accno
FROM Account GROUP BY custno HAVING Count(Custno)>=2);
(d) SELECT custname FROM customer c, account a
WHERE a.custno = c.custno AND a.accno
IN(Select accno FROM Account GROUP BY Accno
HAVING COUNT(Custno)>=2);

BASIC DATABASE MANAGEMENT SYSTEM Page 22


Q66. Consider two relations R1 (A, B) with the tuples (1, 5), (3, 7) and R2 (A, C) = (1, 7), (4, 9).
Assume that R (A, B, C) is the full natural outer join of R1 and R2. Which one of the following
tuple of the form (A, B, C) is not containing by R?
(a) (4, 7, null) (b) (1, 5, 7)
(c) (3, 7, null) (d) (4, null, 9)
Q67. Consider the following three queries on relation S(A, B) and R(B, C)
Q1:SELECT S.A FROM S WHERE S.B NOT IN (SELECT R.B FROM R WHERE R.B
> 5);
Q2:SELECT S.A FROM S WHERE S.B <> ALL (SELECT R.B FROM R WHERE R.B
> 5);
Q3:SELECT S.A FROM S WHERE NOT EXISTS (SELECT R.B FROM R WHERE R.B
> 5 AND R.B = S.B);
(a) The first query is not equivalent to any of the other queries
(b) The first query is equivalent to the second query only
(c) The first query is equivalent to the third query only
(d) All three queries are equivalent
Q68. Consider the following three queries
Q1: SELECT S.A FROM S WHERE S.B NOT >ANY(SELECT R.B FROM R
WHERE R.B > 5);
Q2: SELECT S.A FROM S WHERE S.B <= ALL(SELECT R.B FROM R
WHERE R.B > 5);
Q3: SELECT S.A FROM S WHERE EXISTS(SELECT R.B FROM R
WHERE R.B > 5 AND R.B >= S.B);
(a) The first query is not equivalent to any of the other queries
(b) The second query is equivalent to the third query only
(c) The first query is equivalent to the third query only
(d) All three queries are equivalent.
Q69. Consider the following three queries
Q1: SELECT S.A FROM S WHERE S.B IN (SELECT R.B FROM R
WHERE R.B > 5);
Q2: SELECT S.A FROM S WHERE S.B = ANY (SELECT R.B FROM R
WHERE R.B > 5);
Q3: SELECT S.A FROM S WHERE S.B >= ALL (SELECT R.B FROM R
WHERE R.B > 5);
(a) The first query is not equivalent to any of the other queries
(b) The first query is equivalent to the second query only
(c) The first query is equivalent to the third query only
(d) All three queries are equivalent.

BASIC DATABASE MANAGEMENT SYSTEM Page 23


Q70. Suppose relations R(A,B) and S(B,C,D) have the tuples shown below:
R S
A B B C D
1 2 2 4 6
3 4 4 6 8
5 6 4 7 9
The following SQL query execute on above relations:
SELECT A, R.B, S.B, C, D FROM R, S WHERE R.A < S.C AND R.B < S.D
Then, identify one of the tuples in the result from the list below.
(a) (3,4,5,7,9) (b) (3,4,4,7,8)
(c) (5,6,4,6,9) (d) (1,2,4,7,9)
Q71. Suppose relations R(A,B) and S(B,C,D) have the tuples shown below:
R S
A B B C D
1 2 2 4 6
3 4 4 6 8
5 6 4 7 9
The following SQL query execute on above relations:
SELECT A, R.B, C, D FROM R, S WHERE R.B = S.B
Then, identify which of the following tuple is in the result.
(a)(1,2,6,8) (b)(1,2,4,6)
(c) (5,6,7,9) (d) (1,2,4,8)
Q72. Consider three relations, R(A,B), S(A,B), and T(A,B) have the tuples shown below:
R S T
A B A B A B
0 0 0 0 0 0
0 1 0 1 0 1
1 0 1 0 1 0
1 1 1 1 1 1
The following SQL query execute on above relations:
SELECT R.A, R.B, S.B, T.B FROM R, S, T WHERE R.B = S.A AND
S.B<>T.B
Identify, in the list below, the true statement about whether or not a tuple appears in the
output, and how many times it appears.
(a) (0, 1, 1, 1) appears twice. (b) (0, 0, 0, 1) does not appear.
(c) (0, 0, 0, 0) appears once. (d) (1, 0, 0, 0) does not appear

BASIC DATABASE MANAGEMENT SYSTEM Page 24


Q73. Consider the relation R(X, Y)
R
X Y
1 2
1 2
2 3
3 4
3 4
4 1
4 1
4 1
4 2
Consider the following query
SELECT A1.X, A2.Y, COUNT(*) FROM R A1, R A2 WHERE A1.Y = A2.X
GROUP BY A1.X, A2.Y
Which of the following is a row in the result?
(a) (1, 3, 2) (b) (4, 2, 6)
(c) (4, 3, 1) (d) All of the above

Q74. If the relation R (A, B) has m tuples, and the relation S (B, C) has n tuples, what is the largest
possible size of the output of the natural join R ⋈ S?
(a) Min(m, n) (b) 0
(c) m × n (d) m + n

Q75. If the relation R(A, B) has m tuples, and the relation S(B, C) has n tuples, what is the smallest
possible size of the output of the natural join R ⋈ S?
(a) Min(m, n) (b) 0
(c) m × n (d) m + n

Q76. Suppose that S(A,…) is a relation containing m rows and T(F,…) is a relation containing n
rows. Assume that A is the primary key of S and that F is a foreign key reference to S(A).
Suppose that we perform an inner join between S and T on S.A = T.F. The maximum number
of rows that can be output:
(a) m (b) n
(c) m + n (d) m * n

BASIC DATABASE MANAGEMENT SYSTEM Page 25


Q77. [MSQ]
Suppose that two relations R (A, B) and S (A, B) have exactly the same schema. Consider the
following equalities in relational algebra:
I. R ∩ S = R - (R - S) II. R ∩ S = S - (S - R)
III. R ∩ S = R NATURAL JOIN S IV. R ∩ S = R x S
Which of the following equalities is/are true?

Q78. [MSQ]
Consider the following relation schemas:
R(A, B), R2(A, B) and S(C, D)
Which of the following equalities is/are true?
I. (R − R2) − R2 = R II. (R − R2) − R2) − R2 = R − R2
III. ΠA(R ⋈B=C S) = ΠA(R) IV.(R-R2)-S = S
For next three questions consider a database with the following three tables

And the following results

Q79. What is the resulting table of R ⋈ (S ⋈ T)?

(a) I (b) II (c) III (d) IV


Q80. What is the resulting table of A,B(R ⋈ S) ⋈A,C(S ⋈ T)?

(a) I (b) II (c) III (d) IV


Q81. What is the resulting table of A,B(R ⋈ T) ⋈B,C (S ⋈ T)?

(a) I (b) II (c) III (d) IV

BASIC DATABASE MANAGEMENT SYSTEM Page 26


Q82. Consider two relations with the same schema R (A, B) and S (A, B). Assume that all attributes
are integer’s types and make no assumptions about keys.Which one of the following relational
algebra expressions is not equivalent to the others?
(a) πR.A ((R ∪ S) - S) (b) πR.AR - πR.A(R ∩ S)

(c) πR.A(R - S) ∩ πR.AR (d) They are all equivalent.

Q83. Consider the relations R (A, B), S (A, B, C), and T (A, B, C). Assume that all attributes are
integer’s types and make no assumptions about keys. Which of the following expressions are
equivalent to each other?
1. A,C (B<10(R) ⋈ (S – T))
2. A,C (R ⋈ ((B<10 (S) –B<10 (T)))
3. A,C (A(R) ⋈ ((B<10 (S) – T))
(a) 2 and 3 only (b) 1 and 3 only
(c) 1 and 2only (d) All the above

Q84. Consider a relational database schema with two relations: R1(A, B) and R2(B, C). Assume that
all attributes are integer’s types and make no assumptions about keys. Consider the following
three relational algebra queries.
1. πA,C (R1 ⋈B =1(R2))
2. πA(B =1 (R1)) × πC(B =1(R2))
3. πA,C(πA (R1) × B =1(R2))
Which of the above expressions are equivalent to each other?
(a) 2 and 3 only (b) 1 and 3 only
(c) 1 and 2only (d) All the above

Q85. Consider the following pair of relational algebra queries on R (A, B, C) and S (A, B, C). Assume
that all attributes are integer’s types and make no assumptions about keys.
1. πA(B =1(R)) and B =1(πA(R))
2. πA(A =1(R)) and A =1(πA(R))
3. πA, B((R x S)) and (πA, B(R)) x S
4. B =1(R x S) and (B =1(R)) x S
5. B =1(R ⋈ S)) and (B =1(R)) ⋈ S
How many of the above relational algebra is/are equivalent?
(a) 1 (b) 2
(c) 3 (d) 4

BASIC DATABASE MANAGEMENT SYSTEM Page 27


Q86. Assume that all attributes are integer’s types and make no assumptions about keys. Which of
the following is valid equality of relation algebra queries on relation R(A, B, C) and S(B, C, D)?
(a) A, B (R) = A(R) B (R) (b)A, D (R⋈S) = A(R) ⋈ (D (S))

(c)R.B=S.B and R.C=S.C (RS) = R ⋈ S (d)None of the above


For the next thirteen questions, Consider the following relational schemas:

And the instances (snapshots) of the above schemas:

Q87. Consider the following relational algebra query is executed on the above instance:

The number of rows return by above query is ________.


This query finds the names of sailors who have reserved a red boat.
Q88. Consider the following relational algebra query is executed on the above instance:

The number of rows return by above query is ________.

BASIC DATABASE MANAGEMENT SYSTEM Page 28


Q89. Consider the following relational algebra query is executed on the above instance:

The number of rows return by above query is ________.

Q90. Consider the following relational algebra query is executed on the above instance:

The number of rows return by above query is ________.


Q91. Consider the following relational algebra query is executed on the above instance:

The number of rows return by above query is ________.

Q92. Consider the following tuple relational calculus query is executed on the above instance:

The number of rows return by above query is _______.

Q93. Consider the following tuple relational calculus query is executed on the above instance:

The number of rows return by above query is ________.


Q94. Consider the following tuple relational calculus query is executed on the above instance:

The number of rows return by above query is ________.


Q95. Consider the following tuple relational calculus query is executed on the above instance:

The number of rows return by above query is ________.

BASIC DATABASE MANAGEMENT SYSTEM Page 29


Q96. Consider the following three tuple relational calculus query is executed on the above instance:
1.

2.

3.
Which of the above query(s) finds the names of sailors who have reserved all red boat?
(a) 1 and 3 only (b) 2 and 3 only (c) 1 and 2 only (d) 3 only
Q97. Consider the following domain relational calculus query is executed on the above instance:

The number of rows return by above query is ________.


Q98. Consider the following domain relational calculus query is executed on the above instance:

The number of rows return by above query is ________.

Q99. Consider the following three domain relational calculus query is executed on the above
instance:

1.

2.

3.
Which of the above query(s) find the names of sailors who have reserved boat 103?
(a) 1 and 3 only (b) 2 and 3 only
(c) 1 and 2 only (d) All the above

BASIC DATABASE MANAGEMENT SYSTEM Page 30


NORMALIZATION
Q1. Consider the instance of the relation R(A,B,C,D, E) shown below:
A B C D E
1 2 3 4 5
1 4 3 4 5
1 2 4 4 1
Which of the following functional dependencies hold on the given instance?
I. AB → C II. B → D III. DE → A
(a)I only (b) II only
(c)I and III only (d)II and III only

Q2. Consider the following relation instance R:

Which of the following FDs are not satisfied for the above relation instance?
(a) A → B (b) A → C
(c) C → A (d) AB → C

Q3. Consider the following relation instance R:

Which of the following FDs are satisfied for the above relation instance?
(a) BC → A (b) AC → B
(c) E → ABCD (d) D → A

BASIC DATABASE MANAGEMENT SYSTEM Page 31


Q4. Given the relation R(A,B,C,D) with FDs F = {ABC, AD} shown below: What values
could be inserted for the missing D and A column. The domain for D is
{d1,d2,d3,d4,d5,d6, d7} and the domain for A is {a1,a2,a3,a4}.
A B C D
a1 b1 c1 d1
a1 b2 c2
b1 c1 d3
a4 b1 c4 d4
(a) d1 and a1 only (b) d5 and a4 only
(c) d1 and either a2 or a3 only (d) none of the above

Q5. Suppose that we have the following three tuples in a legal instance of a relation schema
S(A, B, C):
A B C
1 2 3
4 2 3
5 3 3
Which of the following dependencies does NOT hold over schema S based on your
inference?
(a) A→B (b) BC → A
(c) B→C (d) none of the above

Q6. [MSQ]
Consider the following legal instance of a relational schema S(A, B, C):
A B C
a 10 T
b 20 T
c 20 F
c 30 F
Which of the following dependencies are violated by the instances of S in Table?
(a) A → B
(b) B → A
(c) C → A
(d) AC → B

BASIC DATABASE MANAGEMENT SYSTEM Page 32


Q7. Consider a relation R(S, R, T):
S R T
1 2 3
1 3 3
2 1 3
3 4 5
Which one of the following four tuples of the form<S, R, T> can be inserted into R
without violating the functional dependency S → T and R → T?
(a) <1, 1, 2> (b) <3, 1, 2> (c) <2, 4, 1> (d) <2, 3, 3>
Q8. Consider the following statements:
I. We can conclude if a functional dependency holds by examining a single relation
instance.
II. We can conclude if a functional dependency is violated by examining a single
relation instance.
Which of the above statement(s) is/are true?
(a) Only statement I is true. (b) Only statement II is true.
(c) Both I and II are true. (d) Neither I nor II is true.
Q9. Consider the following instance of a relational schema R(A, B, C):
A B C
1 1 1
1 1 0
2 3 2
2 3 2
We can conclude that:
(a) A functionally determines B and B functionally determines C
(b) A functionally determines B and B does not functionally determine C
(c) B does not functionally determine C
(d) A does not functionally determine B and B does not functionally determine C
Q10. [MSQ]
Consider the relational schema R = {P, Q, R, S, T, U, V, W} and the set of functional
dependencies {W → U, RU → VW, PQ → ST, P → R, SV → WU, R → S}. Which of the
following functional dependencies can be deduced, from the above set of functional
dependencies?
(a) PV → W (b) R → T (c) P → S (d) PQR → U

BASIC DATABASE MANAGEMENT SYSTEM Page 33


Q11. [MSQ]
Consider a relation R (A, B, C, D, E) and set of function dependencies {AB → CE, B →
D, D → E}. Which of the following functional dependencies can be deduced, from the
above set of functional dependencies?
(a) AD → CE (b) BC →D
(c) AB → A (d) B → E

Q12. [MSQ]
Which of the following conclusion is/are valid?
(a) If {X→Y, XY→Z}, then {X→Z}. (b) If {XY→Z, Z→X}, then {Z→Y}.
(c) If {XY→Z, Z→W}, then {X→W}. (d) None of these.

Q13. Let relation R(A,B,C,D,E,F,G,H) satisfy the following functional dependencies:


A → B, CH → A, B → E, BD → C, EG → H, DE → F
Which of the following FDs is also guaranteed to be satisfied by R?
(a) ADG → CH (b) CGH → BF
(c) CDE → AF (d) ACG → DH

Q14. [MSQ]
Consider the schema R(A, B, C, D, E, F, H)with the set of functional dependencies {A
D, AE  H, DF  BC, E  C, H  E}. Consider the following functional dependencies:
(a) A AD (b) A  DH
(c) AED  C (d) DH  C
Which of the above dependencies is/are implied by above FDs set?

Q15. [MSQ]
Consider the relation R(A, B, C, D, E, F, G) with the functional dependencies
{AB → CD, AF → D, DE → F, C → G, F → E and G → A}. Which one of the following
closure of attribute set is/are?
(a) CF+ = {A, C, D, E, F, G} (b) BG+ = {A, B, C, D, G}
(c) AF+ = {A, C, D, E, F, G} (d) AB+ = {A, B, C, D, G}

Q16. [MSQ]
Consider relation R(A, B, C, D, E) with the set of functional dependencies
{AB → C, B→ D, DE → A}. Which of the following is/are the possible key(s) of R?
(a) AB (b) DE
(c)ABE (d)BDE

BASIC DATABASE MANAGEMENT SYSTEM Page 34


Q17. [MSQ]
Consider relation R(A,B,C,D,E) with the set of functional dependencies
{A→ B, AB→CD, D→ABCE}. Which of the following is/are possible key(s) of relation R?
(a) A (b)D
(c) AB (d)CD

Q18. Consider relation R(A,B,C,D,E,F,G) with the set of functional dependencies {AB → C,
CD → E, EF → G, FG → E, DE → C, and BC → A}. Which one of the following is the
possible key of R?
(a) ABEF (b) ACDF
(c) BDFG (d) BCDE

Q19. Consider the relation R(A,B,C,D,E) and the set of functional dependencies
F = {A → B, BC → E, ED → A}. Which of the following is not the candidate key of R?
(a) CDE (b) ACD
(c) BCD (d) ABC

Q20. Consider a relation R(A, B, C, D, E) with the set of functional dependencies


{A → B, B →C, C → B and B  E}. How many candidate keys are possible in R? __

Q21. Consider a relation R (A, B, C, D, E) with the set of functional dependencies


{AB→C, CD→E, C→A, C→D and D→B}. How many candidate keys are possible in R?
__

Q22. Consider a relation R(A, B, C, D, E) with the set of functional dependencies


{A → BC, CD → E, B→D and E → A}. How many super keys are possible in R? ______

Q23. Let a Relation R have attributes {A, B, C, D} and ‘A’ is the candidate key. Then how
many super keys are possible? ____

Q24. Let a Relation R have attributes {A, B, C, D, E}. Then how many maximum super key
are possible in R._______

Q25. Let a Relation R have attributes {A, B, C, D, E} and ‘ABC’ is the candidate key. Then
how many super keys are possible? _______

Q26. Let a Relation R have attributes {A, B, C, D, E} and ‘A’ and ‘B’ are the candidate keys.
Then how many super keys are possible? ________

BASIC DATABASE MANAGEMENT SYSTEM Page 35


Q27. Let a Relation R have attributes {A, B, C, D, E} and ‘A’ and ‘BC’ are the candidate keys.
Then how many super keys are possible? _______

Q28. Let a Relation R have attributes {A, B, C, D, E} and ‘AB’ and ‘AC’ are the candidate
keys. Then how many super keys are possible? _____

Q29. Let a Relation R have attributes {A, B, C, D, E} and ‘AB’ and ‘CD’ are the candidate
keys. Then how many super keys are possible? ______

Q30. Consider relation R(R(A, B, C, D, E, F, G, H)) with set of functional dependencies


{CH→G, A→BC, B→CFH, E→A and F→EG}. How many super keys are possible in
relation R? _________

Q31. Assume that X and Y are subsets of the attributes of a relation R. Suppose thatX is a
strict superset of Y (this means that all the attributes in Y appear in X, and X
contains attributes that do not appear in Y).Consider the following two statements
S1: If Y is a key, then is X a key
S2: if X is a key, is Y a key as well
Which of the following two statements is /are true?
(a) Only S1 (b)Only S2 (c) Both S1 and S2 (d) neither S1 nor S2

Q32. [MSQ]
Consider the relation R(A, B, C, D) withtwo sets of functional dependencies F and G:
F = {A→B, B→C, AB→D}
G = {A→B, B→C, A→C, A→D}
Which of the following statement is/are true?
(a) F and G are equivalent (b) F is subset of G
(c) G is subset of F (d) F and G are not equivalent

Q33. Consider the relation R(A, B, C, D) with two sets of functional dependencies F and G:
F = {A→B, B→C,A→C}
G = {A→B, B→C, A→D}
Which of the following statement is/are true?
(a) F and G are equivalent (b) F is subset of G
(c) G is subset of F (d) F and G are not equivalent

BASIC DATABASE MANAGEMENT SYSTEM Page 36


Q34. [MSQ]
Consider the relation R(A, B, C, D, E, F) withtwo sets of functional dependencies F
and G:
F = {A C, AC D, E  AD, E F}
G = {A CD, E AF}.
Which of the following statement is/are true?
(a) F and G are equivalent (b) F is subset of G
(c) G is subset of F (d) F and G are not equivalent

Q35. [MSQ]
Consider the relation R(A, B, C, D, E, F) with two sets of functional dependencies F
and G:
F = {CD → AB, C → D, D → EH, AE → C, A → C, B → D}
G = {B → D, CD → AE, CD →BE, D → EH, A → C, C → B}.
Which of the following statement is/are true?
(a) F and G are equivalent (b) F is subset of G
(c) G is subset of F (d) F and G are not equivalent

Q36. Let relation R(A,B,C,D) hold the following set of functional dependencies F1 = {A → B,
B → C, C → A}. A different set of functional dependencies F2 is equivalent to F1 if
exactly the same FDs follow from F1 and F2. Which of the following sets of FDs is
equivalent to the set above?
(a) A → BC, B → AC (b) B → A, B → C, C → B
(c) B → AC, C → AB (d) A → BC, B → AC, C → AB

Q37. [MSQ]
Given relation schema R(A,B,C,D) with set of functional dependencies {ABC,
BCD, AB}. Which of the following statements is/are true?
(a) BC is a member of F+ (b) ABCD is a member of F+
(c) CDCD is a member of F+ (d)None of the above

Q38. Suppose we have a relation R(A, B, C, D, E) and the set of FD's {A → DE, D → B, and
E → C} If we project R (and therefore it’s FD's) onto schema R1(A, B, C), what is true
about the key(s) for R1?
(a) Only ABC is a key (b) Only A is a key
(c) Only DE is a key (d) A, B, and C are each keys.

BASIC DATABASE MANAGEMENT SYSTEM Page 37


Q39. [MSQ]
If a relation R is in 2 NF, then which of the following condition must be satisfied by
R?
(a) It must be in 1 NF.
(b) All the non-key (non-prime) attributes should be dependent on key (prime)
attributes.
(c)All the non-key (non-prime) attributes are independent of one another.
(d) All the non-key (non-prime) attributes should not be dependent on key (prime)
attributes.

Q40. [MSQ]
If a relation R is in 3 NF, then which of the following condition must be satisfied by
R?
(a). It must be in 2 NF
(b). All the non-key (non-prime) attributes are independent of one another.
(c). All the non-key (non-prime) attributes are dependent of one another.
(d). Every determinant of functional dependency should be candidate key.

Q41. [MSQ]
If a relation R is in BCNF, then which of the following condition must be satisfied by
R?
1. It must be in 3NF
2. All the non-key (non-prime) attributes are independent of one another.
3. All the non-key (non-prime) attributes are dependent of one another.
4. Every determinant of functional dependency should be candidate key.

Q42. A relation is in ____if an attribute of a composite key is dependent on an attribute of


other composite key.
(a) 1NF (b) 2NF
(c) 3NF (d) BCNF

Q43. Suppose that you are given a relation R (A, B, C, D, E). The following set of functional
dependencies hold on R {AB C, C A, CD}. How many attributes of R is prime
attributes? ________

BASIC DATABASE MANAGEMENT SYSTEM Page 38


Q44. Consider the relation R(A,B,C,D) with the set of functional dependencies
{A → B, B → C and BC → A.} Which of the following statement is true?
(a) R is not in 2NF
(b) R is in 2NF but not in 3NF
(c) R is in 3NF but not in BCNF
(d) R is in BCNF.

Q45. Consider the relation R(A,B,C,D,E) with the set of functional dependencies
{ABC → DE and E → BCD}. Which of the following statement is true?
(a) R is not in 2NF (b) R is in 2NF but not in 3NF
(c) R is in 3NF but not in BCNF (d) R is in BCNF.

Q46. Consider the relation R(A,B,C,D,E) with the set of functional dependencies
{A → B, BC → E, ED → A}. Which of the following statement is/are true?
(a) R is not in 2NF (b) R is in 2NF but not in 3NF
(c) R is in 3NF but not in BCNF (d) R is in BCNF.

Q47. Consider the relation R(A, B, C, D, E) with the set of functional dependencies
{ABC → DE, B → C}.Which of the following statement is true?
(a) R is not in 2NF (b) R is in 2NF but not in 3NF
(c) R is in 3NF but not in BCNF (d) R is in BCNF.

Q48. Consider the relation R (A, B, C) with the set of functional dependencies {{AB C,
BA, CB}.Which of the following statement is true?
(a) R is not in 2NF
(b) R is in 2NF but not in 3NF
(c) R is in 3NF but not in BCNF
(d) R is in BCNF.
Q49. Consider the relation R (A, B, C, D) with the set of functional dependencies {A  BCD,
B  C, CD  A}.Which of the following statement is true?
(a) R is not in 2NF
(b) R is in 2NF but not in 3NF
(c) R is in 3NF but not in BCNF
(d) R is in BCNF.

BASIC DATABASE MANAGEMENT SYSTEM Page 39


Q50. Let R(A,B,C,D,E) be a relation schema. The following set of functional dependencies
hold on R {ABC D, ABC  E, D  A and E  B}. The Highest normal form satisfied
by R is
(a) BCNF (b) 3NF (c) 2NF (d) 1NF
Q51. Let R (A, B, C, D, E, F) be a relation schema. The following set of functional
dependencies hold on R {ABC, C B, C D, BC F, D E}. The Highest normal
form satisfied by R is
(a) BCNF (b) 3NF (c) 2NF (d) 1NF
Q52. Let R (A, B, C, D, E) be a relation schema. The following set of functional dependencies
hold on R {B C, D A, A B}. The Highest normal form satisfied by R is
(a) BCNF (b) 3NF (c) 2NF (d) 1NF

Q53. Consider a relation R = (A, B, C, D). For which of the following sets of FDs is R in
BCNF?
(a) {A → D, C → A, D → B, AC → B}
(b) {C → D, CD → A, AB → C, BD → A}
(c) {C → B, D → A, C → D, A → C}
(d) {C → B, BC → A, A → C,BD → A

Q54. Consider a relation R = (A, B,C, D). For which of the following sets of FDs is R in BCNF?
(a){ AB → C, ABD → C, ABC → D, AC → D}
(b) {C → B, B → A, AC → D, AC → B}
(c) {A → B, B → A, A → D, D → B}
(d) Both (c) and (d)

Q55. Consider the relation schema R (A, B, C, D) with set of FDs {ABC, BCD, AB}.
Which FD has an extraneous attribute on the left hand side?
(a) ABC (b) BCD
(c) Both (a) and (b) (d) None of the above

Q56. Consider the relational schema R(A,B,C,D,E,G) with the set of FDs
{ABC  D; B  E, C → G, EG  D}. Which of the attributes are extraneous in the
functional dependency ABC  D?
(a) A (b) B (c) C (d) None of the above

BASIC DATABASE MANAGEMENT SYSTEM Page 40


Q57. Consider the relational schema R(A,B,C,D,E,G,H) with the set of FDs{D →EG, BC→D,
CG→D, AC→B, CE→AG}.Which of the following FD is redundant in the above set of
FDs?
(a) BC→D (b) CG→D (c) AC→B (d)CE→G

Q58. Consider the relational schema R(A,B,C,D,E) with the set of FDsF = {ABCD →
E,E→D,A → B, AC →D}. Which of the following set of FDs is the canonical cover Fc
of F?
(a) {AC → E,E →D,A → B} (b) {ABC → E,E → D,A → B,A→D}
(c) {A →E,E →D,A→B} (d) {AC → E,E → D,A → B, C →D}

Q59. Consider the relational schema R (P, Q, R, S, T, U, V) with the set of FDsF = {P → S,
PQ → ST, S → RU, RU → S, PT → V}. Which of the following set of FDs is the canonical
cover Fc of F?
(a) {P → S; P Q → T; P Q → S; S → R; S → U; P T → V ; RU → S}
(b){P → S; P Q → T; S → R; S → U; P T → V ; RU → S}
(c) The given FD set is already a minimum cover.
(d)None of the above

Q60. Consider the relational schema R = {P, Q,R, S, T, U, V,W} and the set of functional
dependencies {W → U, RU → VW, PQ → ST, P → R, SV → WU, R → S}. Which of the
following set of FDs is the canonical cover Fc of F?
(a) The given FDs set is already a minimum cover.
(b) {W → U, RU → V, PQ → T, P → R, SV → W,R → S}
(c) {W → U,RU → V, PQ → S, PQ → T, P → R, SV→U,R → S}
(d) {W → U,RU → V,RU → W, PQ → T, P → R, SV → W,R → S}

Q61. For relation R = (L, M, N, O, P) the following dependencies hold:


{ M → O, NO → P, P → L and L → MN }
R is decomposed into R1 = (L, M, N, P) and R2 = (M, O). The decomposition is:
(a) Lossless decomposition and dependency preserving
(b) Lossless decomposition and not dependency preserving
(c) Lossy decomposition and dependency preserving
(d) Lossy decomposition and not dependency preserving

BASIC DATABASE MANAGEMENT SYSTEM Page 41


Q62. For relation R = (A, B, C, D, E) the following dependencies hold:
{A→ BC, B → D, CD → E} R is decomposed into R1 = (A, B, C), R2 = (B, D)
and R3 = (C, D, E). The decomposition is:
(a) Lossless decomposition and dependency preserving
(b) Lossless decomposition and not dependency preserving
(c) Lossy decomposition and dependency preserving
(d) Lossy decomposition and not dependency preserving

Q63. [MSQ]
Consider the relation R = (A,B,C,D,E, F) with the following functional dependencies
{A → C, BC → D, F → E}. Which of the following is/are lossless and dependency
preserving decomposition of R?
1. R1 = (A, B, C) and R2 = (C, D, E, F)
2. R1 = (A, B, C, D), R2 = (A, B, D, F) and R3 = (E,F)
3. R1 = (A, B, C, D, F) and R2 = (E, F)
4. None of the above.

Q64. Consider a relation R = (A, B, C, D, E) with the set of functional dependency FDs {A →
BC, CD → E, B → D, E → A}. Which of the following is/are lossless and dependency-
preserving decomposition of R?
1. R1 = (A, B, C) and R2 = (A, D, E)
2. R1 = (A, B, C) and R2 = (C, D, E)
3. R1 = (A, B, C, E) and R2 = (B, D)
(a) Only 2 and 3 (b) Only 1
(c) Only 1 and 3 (d) None of the above

Q65. Consider a relation R = (A, B, C, D, E) with the set of functional dependency FDs
{A → ABCDE, B → C }. Which of the following statement is true?
(a) R1 = (A, C, D, E) and R2 = (B, C) are both in BCNF and preserve lossless-join.
(b) R1 = (A, B, D, E) and R2 = (B, C) are both in BCNF and preserve lossless-join.
(c) both (a) and (b)
(d) None of the above.

BASIC DATABASE MANAGEMENT SYSTEM Page 42


Q66. [MSQ]
Consider a relational schema R(A, B, C, D, E)holds the set of FDs
{A → CD, B → CE, E → B}. Which of the following statements about R is/are true?
(a) The only candidate key of R is AB and AE.
(b) The highest normal form satisfied by R is 2NF
(c) The 3NF decomposition of R is (A, C, D), (B, C, E) and (A, B).
(d) The BCNF decomposition of R is (A, E), (B, E) and (A, C, D)

Q67. Relation R is decomposed using a set of functional dependencies, F, and relation S is


decomposed using another set of functional dependencies, G. One decomposition is
definitely BCNF, the other is definitely 3NF, but it is not known which is which. To
make a guaranteed identification, which one of the following tests should be used on
the decompositions? (Assume that the closures of F and G are available).
(a) Dependency-preservation (b) Lossless-join
(c) BCNF definition (d) 3NF definition

Q68. Given the relation schema R(A,B,C) and functional dependencies


F = {AB, BC, ACB}. What is the result of using the Relational database design
algorithm for producing a database schema which is dependency preserving and has
the lossless join property for relations in 3rd normal form?
(a) R1(A,B), R2(B,C) and R3(A,C,B) (b) R1(A,B) and R2(A,C)
(c) R1(A,B) and R2(B,C) (d) None of the above

Q69. Consider the attribute set R = (A, B, C, D, E, G) and the FD set F = {AB →C, AC → B,
AD → E, B→ D, BC → A, E → G}. Which of the following decompositions of R satisfies
3 NF?
i. R1(AB), R2(BC), R3(ABDE), R4(EG)
ii. R1(ABC), R2(ACDE), R3(ADG)
(A) Only i (b) Only ii
(c) Both i & ii (d) neither i nor ii

Q70. Consider the relation R(A, B, C) with a MVD {A →→ B}. Suppose R currently contain
the following tuples:(a, b1, c1), (a, b2, c2), and (a, b3, c3).How many other tuples must
also be in R?________

BASIC DATABASE MANAGEMENT SYSTEM Page 43


Q71. Consider the relation R(A, B, C, D) with MVD {A →→CD}. Suppose R currently contain
the following tuples: (1, 1, 1, 1) and (1, 2, 2, 2).How many other tuples must also be in
R?_________

Q72. Consider the relation R(A, B, C, D) with MVD {AC→→D}. Suppose R currently contain
the following tuples:
A B C D
1 2 3 1
1 2 4 1
1 2 3 3
5 1 6 2
How many other tuples must also be in R? _________
Q73. Consider a relation R = (A, B, C, D, E) with MVDs: {A →→ B, B →→ D}. Suppose R
currently contain the following tuples: (0, 1, 2, 3, 4) and (0, 5, 6, 7, 8). Which of the
following tuples must also be in R?
(a) (0, 1, 6, 7, 4) (b) (0, 5, 6, 3, 8)
(c) (0, 1, 6, 7, 8) (d) (0, 1, 2, 7, 8)

Q74. [MSQ]
Consider the relation R(A, B, C). Suppose R currently contain the following
tuples:(a1,b1,c1),(a1,b1, c2), (a2, b1, c1) and (a2,b1,c3).Which of the following MVD
is/are not hold in relation R(A,B,C)?
(a) A→→B (b) B→→A
(c) BC→→A (d) B→→AC

BASIC DATABASE MANAGEMENT SYSTEM Page 44


HASHING INDEXING
Q1. Consider an unordered file of 106 records with a record size of 100 bytes stored on blocks
of 4KB with an unspanned record organization. We will assume that no system related
information is stored within a block. How many blocks would be needed to store this
file? _________

Q2. Consider an unordered file of 106 records with a record size of 100 bytes stored on blocks
of 4KB with a spanned record organization. We will assume that no system related
information is stored within a block. How many blocks would be needed to store this
file? __________
Data for the next eight question. Consider a disk with block size B = 512 bytes. A block
pointer is PB = 6 bytes long, and a record pointer is PR = 7 bytes long. A file has r = 30,000
EMPLOYEE records of fixed length. Each record has the following fields: Name (30 bytes),
Ssn (9 bytes), Department_code (9 bytes), Address (40 bytes), Phone (9 bytes), Birth_date (8
bytes), Sex (1 byte), Job_code (4 bytes), and Salary (4 bytes, real number). Other than the
record fields, an additional byte is used as a deletion marker in each record. Suppose the file
is ordered by the key field Ssn and we want to construct a primary index on Ssn. Answer the
following questions.

Q3. The record size R of the file is________bytes

Q4. The number of file blocks b assuming an unspanned organization is _______

Q5. The index blocking factor bfri (which is also the index fan-out fo) is________

Q6. The number of first-level index entries is _________

Q7. The number of first-level index blocks is___________

Q8. The number of levels needed if we make it into a multi-level index_______

Q9. The total number of blocks required by the multi-level index is_____

Q10. The number of block accesses needed to search for and retrieve a record from the file,
given its Ssn value using the primary index is________

BASIC DATABASE MANAGEMENT SYSTEM Page 45


Data for the next five question. Consider a disk with block size B = 512 bytes. A block
pointer is PB = 6 bytes long, and a record pointer is PR = 7 bytes long. A file has r = 30,000
EMPLOYEE records of fixed length. The size of each record is 115 bytes. Suppose the file is
not ordered by the key field Ssn (9 bytes) and we want to construct a secondary index on SSN.
Answer the following questions.
Q11. The number of first-level index entries is _________

Q12. The number of first-level index blocks is__________

Q13. The number of levels needed if we make it into a multi-level index_______

Q14. The total number of blocks required by the multi-level index is______

Q15. The number of block accesses needed to search for and retrieve a record from the file,
given its Ssn value using the primary index is________

Q16. Consider a file of r = 20000 records. Each record is R = 50 bytes long and its key field
is of size V = 10 bytes. The file is ordered on a key field, and the file organization is
unspanned. The file is stored in a file system with block size B = 1000 bytes, and the
size of a block pointer is P = 10 bytes. If the primary index is built on the key field of
the file, and a multi-level index scheme is used to store the primary index, The total
number of blocks required by the multi-level index is________

Q17. Consider a file of r = 20000 records. Each record is R = 50 bytes long and its key field
is of size V = 10 bytes. The file is ordered on a non-key field, and the file organization
is unspanned. The file is stored in a file system with block size B = 1000 bytes, and the
size of a block pointer is P = 10 bytes. If the secondary index is built on the key field of
the file, and a multi-level index scheme is used to store the secondary index, The total
number of blocks required by the multi-level index is_______

Q18. Suppose that we have an ordered file with r = 30,000 records stored on a disk with block
size B = 1024 bytes. File records are of fixed size and are unspanned, with record length
R = 100 bytes. Now suppose that the ordering key field of the file is V = 9 bytes long, a
block pointer is P = 6 bytes long, and we have constructed a primary index for the file.
Let x and y be the number of blocks required to access a record in case of without index
and with primary index using binary search respectively. Then the value of x – y is____

BASIC DATABASE MANAGEMENT SYSTEM Page 46


Q19. [MSQ]
Consider the following statements:
i. For any data file, it is possible to construct two separate sparse first level indexes
on different keys
ii. For any data file, it is possible to construct two separate dense first level indexes on
different keys.
iii. For any data file, it is possible to construct a sparse first (lower) level index and a
dense second (higher) level index. Both indices should be useful.
iv. For any data file, it is possible to construct a dense first (lower) level index and a
sparse second (higher) level index. Both indices should be useful
Which of the above statements is/are true?
(a) (i) & (ii)
(b) (ii) & (iv)
(c) (ii) & (iii) & (iv) (
d) All are true

Data for the next five questions, Consider a disk with block size B = 512 bytes. A block
pointer is PB = 6 bytes long, and a record pointer is PR = 7 bytes long. A file has r = 30,000
EMPLOYEE records of fixed length. The size of each record is 115 bytes. Suppose the file is
not ordered by the key field Ssn (9 bytes) and wewant to construct a B+-tree access structure
(index) on Ssn. An non-leaf node of the B+-tree can have up to p child pointers and p – 1
search key fields; The leaf nodes of the B+-tree can have up to p record pointers, p search key
fields and the a next pointer, these must fit into a single block.
Q20. The order of the non-leaf node of the B+-tree is_________

Q21. The order of the leaf node of the B+-tree is________

Q22. The number of leaf-level blocks needed if blocks are at most70% full is_________

Q23. The number of levels needed if internal nodes are also at most 70% full is______

Q24. The total number of blocks required by the B+-tree is________

BASIC DATABASE MANAGEMENT SYSTEM Page 47


Data for the next three questions, Consider a disk with block size B = 512 bytes. A block
pointer is PB = 6 bytes long, and a record pointer is PR = 7 bytes long. A file has r = 30,000
EMPLOYEE records of fixed length. The size of each record is 115 bytes. Suppose the file is not
ordered by the key field Ssn (9 bytes) and we want to construct a B-tree access structure (index)
on Ssn. An node of the B+-tree can have up to p child pointers, p – 1 search key fields and p –
1record pointers, these must fit into a single block.
Q25. The order of the node of the B+-tree is________

Q26. The number of leaf-level blocks needed if blocks are at most 70% full is________

Q27. The total number of blocks required by the B-tree is________

Q28. The following set of key {2, 3, 5, 7, 11, 17, 19, 23, 29, and 31} are inserted into a empty B+-
tree of order 3. Which of the following is true after the tree has been constructed?
(a) The root has only one key value 19.
(b) The root has two key values 17 and 19.
(c) The root has only one key value 11.
(d) Key value 31 is alone in a leaf node

Q29. A B-tree of order 10 is built-up by inserting the keys 10, 20, 30, 25, 15, 5, 17, 27, 37, 35, 32
and 22 in that order to an empty tree. Which of the following statement is correct about the
resulting tree?
(a) The tree is of height 3
(b) The root node has three keys
(c) The root node always contains a single key 25
(d) Altogether there are three nodes in the tree

Q30. Consider the following B+ tree of order 3:

If we insert 26 in above tree the resulting tree will be?

BASIC DATABASE MANAGEMENT SYSTEM Page 48


Q31. A PARTS file with Part# as the key field includes records with the following Part# values:
23, 65, 37, 60, 46, 92, 48, 71, 56, 59, 18, 21, 10, 74, and 78. Suppose that the search field
values are inserted in the given order in a B+-tree of order p = 4 and pleaf = 3. The number
of leaf nodes in the B+-tree after all values are inserted is_______

Q32. A PARTS file with Part# as the key field includes records with the following Part# values:
23, 65, 37, 60, 46, 92, 48, 71, 56, 59, 18, 21, 10, 74, and 78. Suppose that the search field
values are inserted in the given order in a B-tree of order p = 4. The number of time the
node of B tree splits during insertion is (assume that left biasing is used)________

Q33. Consider the B tree of order 10. Assume that the number of levels in the tree is four
including root. The maximum number of record pointers that can be stored in B tree is
_______________

BASIC DATABASE MANAGEMENT SYSTEM Page 49


Q34. Consider the B tree of order 10. Assume that the number of levels in the tree is four
including root. The minimum number of record pointers that can be stored in B tree is
_______________

Q35. Consider the B+tree of order 10. Assume that the number of levels in the tree is four
including root. The maximum number of record pointers that can be stored in B+tree is
_______________

Q36. Consider the B+tree of order 10. Assume that the number of levels in the tree is four
including root. The minimum number of record pointers that can be stored in B+tree is
_______________

For next two questions consider a B+ Tree where each node can have at most 3 keys. Suppose
the tree initially has a root node with two children leaf nodes, which contain keys {1, 3, 5} and {7,
9, 11} respectively. The root node has a single key 7.

Q37. [MSQ]
Distinct keys from the set {0, 2, 4, 6, 8, 10, 12} are added to the tree in some order, which
causes the tree to grow by one level. Which set of four/five keys could be added to the tree?
i. {0, 8, 10, 12} ii. {0, 2, 4, 6, 8}
iii. {0, 2, 10, 12} iv. {2, 4, 8, 10}

Q38. Suppose we are back to the original tree with two leaf nodes having keys {1, 3, 5} and {7, 9,
11}. And the root node has a single key 7 Now X distinct keys from the set {0, 2, 4, 6, 8, 10,
12} are added to the tree in some order, and the tree does not grow a level. What is the
maximum possible value of X?__________

Q39. Consider the B+-tree index of order 5 shown in the figure below.

How many nodes that must be fetched to answer the following query: “Get all records with
search key greater than 25 and less than 70.”____________

BASIC DATABASE MANAGEMENT SYSTEM Page 50


Q40. Given a hash table T with 20 slots that stores 2000 elements, the load factor α for T is
__________

Q41. The following set of keys {10 28 2 7 45 25 40 29} in the given order are inserted into the
empty hash table shown below:
Bucket 0 1 2 3 4 5 6 7 8 9 10
Key Value
The hash function h(x) = (key) mod 11. The collisions will be resolved by linear probing.
Which bucket will 29 eventually occupy?
(a)10 (b) 8
(c) 9 (d)7

Q42. [MSQ]
Consider the hash table of length 10 uses the hash function h(x) = x mod 10.The collisions
are resolved by linear probing. After inserting six integer keys into an initially empty hash
table, the array of keys is:
Array 0 1 2 3 4 5 6 7 8 9
Key Value 42 23 34 52 46 33
Assume that the length of the hash table does not change during the insertions. Which of
the following choice(s) are insertion sequences resulting in the above hash table?
1. 46, 42, 34, 52, 23, 33
2. 34, 42, 23, 52, 33, 46
3. 46, 34, 42, 23, 52, 33
4. 42, 23, 34, 52, 46, 33

Q43. The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of
length 10 using open addressing with hash function h(k) = k mod 10 and quadratic
rehashing. What is the resultant hash table after the insertion of all keys?

BASIC DATABASE MANAGEMENT SYSTEM Page 51


Q44. The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of
length 10 using open addressing with hash function h(k) = k mod 10 and linear probing.
What is the resultant hash table?

Q45. Consider a hash table of size 11 that uses open addressing with linear probing. Let h (k) =
k mod 11 be the hash function used. A sequence of records with key 43, 36, 92, 87, 11, 4, 71,
13 and 14 is inserted into an initially empty hash table, the buckets of which are indexed
from zero to ten. What is the index of the bucket into which the last record is inserted?
___________

Q46. Consider the hash table with 10 slots. The hash function is h(K) = k mod 10. The collisions
are resolved by chaining. The following 9 keys are inserted in the order: 5, 28, 19, 15, 20,
33, 12, 17, and 10.The average chain lengths of the hash table is _______

Q47. Consider a hash table of size 7 with hash function: H(k) = k mod 7. The following values:
19, 26, 13, 48 and 17 are inserted in the given order. Collisions are handled by double
hashing using a second hash function:
 H’(k) = 5 – (k mod 5). The double hashing performs in the following way:
 Check location H(k). If it is empty, put record in it.
 If it is not empty calculate H’(k).
 Check if (H(k)+H’(k))mod 7 is empty, if it is, put record in it.
 If it is not, repeat with (H(k)+2*H’(k))mod 7,( H(k)+3*H’(k)mod 7,( H(k)+4*H’(k)) mod 7
and so on, until an opening is found.
Which of the following is the correct table after inserting the values?

BASIC DATABASE MANAGEMENT SYSTEM Page 52


Q48. Consider a double hashing scheme in which the primary hash function is h1(k)=k mod 11,
and the secondary hash function is h2(k)=5 – (k mod 5). Assume that the table size is 11.
Collisions are handled by double hashing using a secondary hash function. What will be in
the resultant hash table after the following sequence of insertions 16, 23, 9, 34, 12, 56?

Q49. Which of the following hash functions will distribute keys more uniformly over 10 buckets
numbered 0 to 9 for i ranging from 0 to 1000?
(a) i2 mod 10 (b) i3 mod 10
(c) 10*i mod 10 (d) i mod 10

Q50. Consider a hash function that distributes keys uniformly. The hash table size is 40. After
hashing of how many keys will the probability that any new key hashed collides with an
existing one exceed 0.5? _________

Q51. If we assume uniform hashing, what is the probability that a collision will occur in a hash
table with 1000 buckets and 3 keys?
3 3
(a) 1000 (b) 1 - 1000
999 998 997 999 998
(c)1000×1000×1000 (d) 1 – (1000×1000)

Q52. We hash n keys into k=1000 memory locations one by one. What is the probability that the
first i records do not produce a collision? Assume each keys is independently and uniformly
hashed into the memory locations.
1000!
(a) 1000𝑖 (b)(1000Ci)/1000i

(c)(1000Pi)/1000i (d) none of these

BASIC DATABASE MANAGEMENT SYSTEM Page 53


Data for the next two questions. Consider a dynamic hashing approach for 4-bit integer keys:
1. There is a main hash table of size 4.
2. The 2 least significant bits of a key is used to index into the main hash table.
3. Initially, the main hash table entries are empty.
4. Thereafter, when more keys are hashed into it, to resolve collisions, the one of all keys
corresponding to a main hash table entry is organized as a binary tree that grows on demand.
5. First, the 3's least significant bit is used to divide the keys into left and right sub-trees.
6. To resolve more collisions, each node of the binary tree is further sub-divided into left and right
sub-trees based on the 4th least significant bit.
7. A split is done only if it is needed, i.e., only when there is a collision.

Q53. Consider the sequence of keys inserted into empty hash table: 9, 5, 10, 6, 7 and 1. Assume
that all the keys are in decimal. Which of the following is state of the hash table after the
insertion of above keys?

(a)

(b)

(c)

(d)

BASIC DATABASE MANAGEMENT SYSTEM Page 54


Q54. Consider the following state of hash table:

Assume that all the keys are in decimal. Which of the following sequence of key
insertions can cause the above state of the hash table?
(a) 10, 5, 14, 9, 6, 13
(b) 6, 10, 14, 9, 5, 1
(c) 9, 6, 10, 14, 5, 13
(d) None of the above.
Data for the next two questions. Given the following items to insert into a hash table of
size 10.
 The items are to be inserted starting from the top of the list and working down.
 The primary hash function is key modulus table size.
 The collision resolution strategy is separate chaining
Q56. The load factor after all of the items have been inserted is______________

Q57. The average number of probes needed for successful search over all of the keys in the
original item set, after all of the items have been inserted is__________

BASIC DATABASE MANAGEMENT SYSTEM Page 55


TRANSACTION
Q1. [MSQ]
Which of the following is/are NOT a property of database transactions?
(a) Consistency (b) Integrity
(c) Atomicity (d) Durability

Q2. Consider the following statement:


Either all operations of the transaction are reflected properly in the database, or none
are.
Which one of the property of a transaction that the above statement describes?
(a) Atomicity (b) Consistency
(c) Isolation (d) Durability

Q3. Isolation of the transactions is achieved by


(a) Avoiding simultaneous transactions. (b) Storing updates permanently.
(c) Preventing system failure. (d) Concurrency control.

Q4. The property of a transaction that persists all the crashes is


(a) Atomicity (b) Durability
(c) Isolation (d) All of the mentioned

Q5. The database system must take special actions to ensure that transactions operate
properly without interference from concurrently executing database statements. This
property is referred to as
(a) Atomicity (b) Durability
(c) Isolation (d) All of the mentioned

Q6. Database transaction durability ensures that in the event of a system failure
(a) A transaction is not lost once it has been committed.
(b) A transaction is completed uninterrupted.
(c) A transaction is revered before it is executed.
(d) A transaction is saved before the failure occurs.

Q7. If several concurrent transactions are executed over the same data set and the second
transaction updates the database before the first transaction is finished, the ____
property is violated and the database is no longer consistent.
(a) Atomicity (b) Consistency
(c) Isolation (d) Durability

BASIC DATABASE MANAGEMENT SYSTEM Page 56


Q8. [MSQ]
Which of the following is/are correct?
Responsibilities of Transaction-management component :
(a) Ensures that the database remains in a consistent state despite Power failures
(b) Ensures that the database remains in a consistent state despite Operating system
crashes
(c) Ensure the consistency of the database during interaction among the concurrent
transactions
(d) Ensure consistency of database by orchestrating all access requests issued by the
transactions

Q9. Identify the correct mechanism to ensure the isolation property of a set of transactions.
(a) Recovery manager
(b) Concurrency control system
(c) Security management system
(d) Query optimization techniques

Q10. When a transaction completes the execution of its final statement, it enters a state.
What is the name of this state?
(a) Partially Committed state
(b) Committed state
(c) Failed state
(d) Aborted State

Q11. Consider the following schedule S = r1(x); r1(y); w1(y); r2(y); r2(x); w2(y); w2(x); r2(z);. How
many conflicting pairs are there in the schedule S? _______

Q12. Consider the following scheduleS = r2(y); w2(y); r3(y); r1(x); w1(x); w3(y); r2(x); r1(y);
w1(y);.How many conflicting pairs are the in the schedule?__________

BASIC DATABASE MANAGEMENT SYSTEM Page 57


Q13. Consider the following schedule involving three transactions T1, T2 and T3:

Which one of the following is the correct precedence graph of the above schedule

(a) (b)

(c) (d)
Q14. Consider the following three schedulesS1, S2 and S3 involving three transactions T1,
T2 and T3:
S1: r1(Y); r2(X); r2(Y); r3(Y); w2(X); w1(Y); w3(X); r1(X);
S2: r1(A); r2(A); r3(A); w1(B); w2(B); w3(B);
S3: w3(A); r1(A); w1(B); r2(B); w2(C); r3(C);
And the following three precedence graph:
I. II. III.

Which of the following is the correct matching of the schedules to its precedence graphs?
(a) S1 – I, S2 – II, S3 – III
(b) S1 – II, S2 – I, S3 – III
(c) S1 – I, S2 – III, S3 – II
(d) S1 – III, S2 – I, S3 – II

BASIC DATABASE MANAGEMENT SYSTEM Page 58


Q15. Consider the following three schedules of transactions T1, T2 and T3.
S1: r2(A),w2(A), r3(C), w2(B), w3(A), w3(C), r1(A), r1(B), w1(A), w1(B)
S2: r3(C), r2(A), w2(A), w2(B), w3(A), r1(A), r1(B), w1(A), w1(B), w3(C)
S3:r2(A), r3(C), w3(A), w2(A), w2(B), w3(C), r1(A), r1(B), w1(A), w1(B)
Which of the following statements is TRUE?
(a) S1, S2 and S3 are all conflict equivalent to each other
(b) No two of S1, S2 and S3 are conflict equivalent to each other
(c) S2 is conflict equivalent to S3, but not to S1
(d) S1 is conflict equivalent to S2, but not to S3

Q16. Suppose a database schedule S involves transactions T1,........,Tn. Construct the


precedence graph of S with vertices representing the transactions and edges
representing the conflicts. If S is serializable, which one of the following orderings of
the vertices of the precedence graph is guaranteed to yield a serial schedule?
(a) Topological order
(b) Depth-first order
(c) Breadth- first order
(d) Ascending order of the transaction indices

Q17. Consider the following schedule involving two transactions:


S = r1(X); r2(X); r3(X); r1(Y);w2(Z); r3(Y); w3(Z); w1(Y);.
Which one of the following statements is TRUE?
(a) The schedule is conflict-equivalent to (T3, T2, T1)
(b) The schedule is not serializable
(c) The schedule is conflict-equivalent to (T2, T3, T1)
(d) The schedule is not conflict serializable

Q18. Consider the following schedules involving three transactions:


S1: r1(X); r2(Z); r1(Z); r3(X); r3(Y), w1(X); w3(Y); r2(Y), w2(Z); w2(Y);
S2: r1(X); r2(Z); r3(X); r1(Z); r2(Y), r3(Y); w1(X); w2(Z), w3(Y); w2(Y);
Which one of the following statements is TRUE?
(a) S1 is conflict serializable and S2 is not conflict serializable.
(b) S1 is not conflict serializable and S2 is conflict serializable.
(c) Both S1 and S2 are conflict serializable.
(d) Both S1 and S2 are not conflict serializable.

BASIC DATABASE MANAGEMENT SYSTEM Page 59


Q19. Consider the following schedules involving three transactions:
S1: r3(X); r2(X); w3(X); r1(X); w1(X)
S2: r3(X); r2(X); r1(X); w3(X); w1(X);
Which one of the following statements is TRUE?
(a) S1 is conflict serializable and S2 is not conflict serializable.
(b) S1 is not conflict serializable and S2 is conflict serializable.
(c) Both S1 and S2 are conflict serializable.
(d) Both S1 and S2 are not conflict serializable.

Q20. Consider the following schedules involving three transactions:


S1: r1(X);r2(X);w1(Y);w2(Y);r1(Y);r2(Y);
S2: w3(X);r1(X);w1(Y);r2(Z);w2(Z);r3(Z);
Which one of the following statements is TRUE?
(a) S1 is conflict serializable and S2 is not conflict serializable.
(b) S1 is not conflict serializable and S2 is conflict serializable.
(c) Both S1 and S2 are conflict serializable.
(d) Both S1 and S2 are not conflict serializable.

Q21. Consider the following schedule:


S: r1(y), r2(x), r2(y), r3(y), w2(x), w1(y), w3(x), r1(x)
Which of the following statements is true about the schedule S?
(a) S is conflict serializable but not view serializable
(b) S is neither conflict serializable nor view serializable
(c) S is both conflicts serializable as well as view serializable
(d) S is view serializable but not conflict serializable

Q22. Given the following two schedules:


S1: r1(x), r2(x), w2(x), r3(x), w1(x), w2(y), r3(y), w3(x)
S2: r2(x), r1(x), w1(x), w2(x), w2(y), r3(x), w3(x), r3(y)
Which one of the following statements is TRUE?
(a) S1 is view serializable and S2 is not view serializable.
(b) S1 is not view serializable and S2 is view serializable.
(c) Both S1 and S2 are view serializable.
(d) Both S1 and S2 are not view serializable.

BASIC DATABASE MANAGEMENT SYSTEM Page 60


Q23. Consider the following schedule S of transactions T1, T2, and T3:
S: r1(A); r2(A); r3(B); w1(A); r2(C); r2(B); w2 (B) w1(C);
Which one of the schedules below is the correct serialization of the above?
(a) T3 T1 T2 (b) T2  T3  T1 (c) T3  T2  T1 (d) T2  T1  T3

Q24. Suppose two schedules S1 and S2 of the same set of transactions and we know that S1
is conflict serializable, and the precedence graphs of the two schedules are the same,
i.e. P(S1) = P(S2). Consider the following claims about S2:
(i) S2 is serial schedule
(ii) S2 is conflict serializable
(iii) S2 is conflict equivalent to S1
Which of the above is/are valid claims?
(a) i and ii only (b) ii and iii only (c) ii only (d) iii only

Q25. [MSQ]
Consider the following two schedules S1, S2 over transactions T1, T2, T3:

Which of the following is/are the correct statement about above schedules?
(a) S1 and S2 are conflict equivalent
(b) Both S1 and S2 are conflict serializable
(c) Both S1 and S2 are view serializable
(d) None of the above
Q26. Consider the following two schedules involving three transactions:
S1: r2(B), w2(B), r3(C), w3(C), r3(A), w3(A), c3, r2(C), w2(C), c2, r1(A), r1(B), w1(A),
w1(B), c1;
S2: r1(A), r2(B), r3(C), r1(B), r2(C), r3(D), w1(A), w2(B), w3(C), w1(A), c1,c2,c3
Which of the following schedule is/are possible under basic 2PL?
(a) Only S1is possible under basic 2PL
(b) Only S2 is possible under basic 2PL
(c) Both S1 and S2 are possible under basic 2PL
(d) Both S1 and S2 are not possible under basic 2PL

BASIC DATABASE MANAGEMENT SYSTEM Page 61


Q27. Consider the following two schedules involving three transactions:
S1: r1(A), r2(B), r3(C), r1(B), r2(C), r3(D), w1(A), w2(B), w3(C), w1(A), c1,c2,c3
S2: r1(A), r2(B), r3(C), r1(B), r2(C), r3(A), w1(A), w2(B), c2, w3(C), c3, w1(A), c1
Which one of the following statement is TRUE
(a) Only S1 is possible under basic strict 2PL
(b) Only S2 is possible under basic strict 2PL
(c) Both S1 and S2 are possible under strict 2PL
(d) Both S1 and S2 are not possible under strict 2PL

Q28. Consider the following schedule:


S: r2(A), w1(B), w1(C), r3(B), r2(B), r1(A), c1, r2(C), c2, w3(A), c3;
Which of the following is/are correct about above schedule?
S1: Schedule(S) is not conflict serializable schedule.
S2: Schedule(S) is allowed by basic 2PL.
S3: Schedule(S) is view serializable schedule.
S4: Schedule(S) is allowed by strict 2PL.
(a) Only S1, S2 and S3
(b) Only S2 and S3
(c) Only S3 and S4
(d) Only S2, S3 and S4

Q29. Consider the following schedule:


Steps T1 T2 T3
1 w(A)
2 w(A)

3 w(B)

4 w(B)
5 w(B)
Which one of the following statement is TRUE?
(a) Above schedule is possible under 2PL but not under timestamp based protocol
(b) Above schedule is not possible under 2PL but possible under timestamp based
protocol
(c) Above schedule is possible under 2PL and timestamp based protocol
(d) Above schedule is neither possible under 2PL nor under timestamp based protocol

BASIC DATABASE MANAGEMENT SYSTEM Page 62


Q30. Consider the following schedule
S: r1(x), r3(y), r3(x), w1(x), c1, w2(y), r2(x), w3(y), c2, c3
Which one of the following statements is TRUE?
(a) S is not recoverable but cascade less.
(b) S is recoverable but not cascade less.
(c) S is both recoverable and cascade less.
(d) S is neither recoverable nor cascade less.

Q31. Consider the following schedules involving two transactions:


S1: r1(x), r2(x), w2(x), r3(x), w1(x), w2(y), r3(y), c2, w3(x), c1, c3
S2: r2(x), r1(x), w1(x), w2(x), w2(y), r3(x), w3(x), r3(y), c1, c3, c2
Which one of the following statements is TRUE?
(a) S1 is recoverable and S2 is not recoverable.
(b) S1 is not recoverable and S2 is recoverable.
(c) Both S1 and S2 are recoverable.
(d) Both S1 and S2 are not recoverable.

Q32. Consider the following schedules involving two transactions:


S1: r1(x), r2(x), w2(x), r3(x), w1(x), w2(y), r3(y), c2, w3(x), c1, c3
S2: r2(x), r1(x), w1(x), w2(x), w2(y), r3(x), w3(x), r3(y), c1, c3, c2
Which one of the following statements is TRUE?
(a) S1 is cascade less and S2 is not cascade less.
(b) S1 is not cascade less and S2 is cascade less.
(c) Both S1 and S2 is cascade less.
(d) Both S1 and S2 is not cascade less.

Q33. For the schedule S given below, if transaction T1 aborts after the last operation of
schedule S, then which of the following statements will be true?
S: r1(x), r2 (z), w1(x), r3(x), r2(y), w2(y), w3(x), r3(y), r2(x)
(a) Only T3 will be rolled back.
(b) First T2 will be rolled back followed by T3 rollback.
(c) First T3 will be rolled back followed by T2 rollback.
(d) There will be no cascading rollbacks.

BASIC DATABASE MANAGEMENT SYSTEM Page 63


Q34. Consider the following schedule
S: r1(x), r2 (z), w1(x), r3(x), r2(y), w2(y), w3(x), r3(y), r2(x)
For the schedule S given above, two orderings of commit operations are specified.
I: c1; c3; c2 II: c1; c2; c3
Which of these ordering ensures recoverability of schedule S?
(a) Only I (b) Both I and II
(c) Only II (d) None of these

Q35. Consider the following schedule:


S: r1(y), r2 (z), w1(y), w1 (z), r2(x), w2(x), r2(y), w2(y), r1(x), c1, c2
Which of the following is true about S?
(a) S is cascade-less.
(b) S is not cascade-less, but recoverable.
(c) S is not recoverable, but changing the order of commits to c2; c1 makes the schedule
recoverable.
(d) S is not recoverable, and changing the order of commits to c2; c1 does not make the
schedule recoverable.

Data for the next four questions, consider the following class of schedules:
C1: A schedule is conflict serializable if it can be transformed into a serial schedule by
swapping pairs of non-conflicting actions. Two action conflicts if they involve the same
data item and at least one of them is a write.
C2: A schedule is recoverable if every transaction commits only after all transactions whose
changes they read have committed.
C3: A schedule is cascade-less when it avoids dirty reads: reads of data that have been
modified by uncommitted transactions.
C4: A schedule is strict if a value written by a transaction T is not read or overwritten by
other transactions until T either aborts or commits.
and the following schedules:
S1: r1(A), w2(A), w1(A), Abort2, Commit1
S2: w1(A), r2(A), w1(A), Commit2, Commit1
S3:r1(A), w2(B), R2(A), w1(B), Commit1, Commit2
S4:r1(A),r2(B), w1(C), Commit1, r3(B), r3(C), w2(B), w3(A), Commit2, Commit3 Identified that
schedule belong to which class.
Q36. Which of above schedule belong to C1 class?
(a) S3 and S4 only (b)S3 only
(c)S1 and S2 only (d)S4 only

BASIC DATABASE MANAGEMENT SYSTEM Page 64


Q37. Which of above schedule belong to C2 class?
(a) S1 and S3
(b) S1, S3 and S4 only
(c)S2 and S3 only
(d) S4 only

Q38. Which of above schedule belong to C3 class?


(a) S1 and S3
(b) S1, S3 and S4 only
(c)S2 and S3 only
(d) S4 only

Q39. Which of above schedule belong to C4 class?


(a) S1 and S3
(b) S1, S3 and S4 only
(c)S2 and S3 only
(d) S4 only

Q40. Consider the following schedule


Time T1 T2
t0 Read_item(X);
t1 X = X-N;
t2 Read_item(X);
t3 X = X+M;
t4 Write_item(X)
t5 Read_item(Y);
t6 Write_item(X);
t7 Y=Y+N;
t8 Write_item(Y);
Which of the following concurrency problem exist in the above schedule?
(a) Lost update
(b) Dirty read
(c) Unrepeatable read
(d) Both (a) and (b)

BASIC DATABASE MANAGEMENT SYSTEM Page 65


Q41. Consider the following schedule
Time T1 T2
t0 Read_item(X);
t1 X = X-N;
t2 Write_item(X)
t3 Read_item(X);
t4 X = X+M;
t5 Write_item(X)
t6 Read_item(Y);
Which of the following concurrency problem exist in the above schedule?
(a) Lost update (b) Dirty read
(c) Unrepeatable read (d) Both (a) and (b)

Q42. Consider the following schedule


Time T1 T2
t0 Read_item(X);
t1 Read_item(X);
t2 X = X+M;
t3 Write_item(X)
t4 Read_item(X);
Which of the following concurrency problem exist in the above schedule?
(a) Lost update (b) Dirty read
(c) Unrepeatable read (d) Both (b) and (c)

Q43. Consider the following schedule S = r1(a); w2(a); w1(b); r2(c); w2(b); r3(c); w3(c); r3(c).
Which of the following statements is/are true about schedule?
i. The schedule exhibits the Dirty Read anomaly.
ii. The schedule exhibits the Unrepeatable Read anomaly.
iii. The schedule exhibits the Lost Update anomaly.
(a) i only (b) ii only (c) iii only (d) ii and iii only
Q44. Consider the following schedule S = w2(a); r1(a); r2(c); w1(b); w2(b); r2(c); w2(c); r1(c);.
Which of the following statements is/are true about schedule?
i. The schedule exhibits the Dirty Read anomaly.
ii. The schedule exhibits the Unrepeatable Read anomaly.
iii. The schedule exhibits the Lost Update anomaly.
(a)i only (b) i and iii only (c)ii only (d)ii and iii only

BASIC DATABASE MANAGEMENT SYSTEM Page 66


Q45. Consider the following schedule under timestamp based concurrency control protocol
with TS(T1)=1, TS(T2)=2, and TS(T3)=3. Assume A=5, B=10, and C=10, and that any
data timestamps are all initially 0.
Steps T1 T2 T3
1 r(B)
2 r(C)

3 r(A)

4 w(C)
5 r(C)
6 r(B)
7 w(B)
Which one of the following statement is TRUE?
(a) The schedule is possible under Timestamp based concurrency control protocol
(b) Both Transaction T2& T3 will be roll backed
(c) Only transaction T3 will be roll backed
(d) More than one transactions will be roll backed

Q46. Assume that the four transactions are executed under a timestamp based scheduler
using timestamps: 0 <ts(T0) <ts(T1) <ts(T2) <ts(T3). Assume that Thomas' write rule was
not applied.
S1: r2(x), w3(x), w1(y) w0(v), r2(y), w1(v), w2(z)
S2: r2(x), w3(x), r2(y), w0(v), w1(y), w1(v), w2(z)
S3: w1(y), r2(x), w0(v), w3(x), r2(y), w2(z), w1(v)
S4: w0(v), r2(x), r2(y), w3(x), w1(y), w1(v), w2(z)
Which of the above schedule is possible under timestamp based scheduling?
(a) Only S1
(b) Only S3 and S4
(c) Only S2 and S4
(d) Only S1 and S3

BASIC DATABASE MANAGEMENT SYSTEM Page 67


Q47. Consider the following schedule for transaction T1, T2 and T3.
S: r1(x), r2(y), r3(y) w1(x), w3(x), r2(z), w1(x)
Also assume that the time-stamp for the three transactions T1, T2 and T3 is 30, 10, and
20 respectively. Which of the following statement is true with respect to above schedule?
(a) The schedule is allowed under the basic time-stamp but not the Thomas write-stamp
protocol
(b) The schedule is not allowed under any of the basic time-stamp protocol as well as
Thomas write.
(c) The schedule is allowed under both basic time-stamp protocols as well as Thomas
write.
(d) The schedule is allowed under Thomas write time-stamp protocol but not basic time-
stamp protocol

Q48. [MSQ]
Consider three transactions T1, T2, T3 with the following sequences of operations:
 T1: r1(A), w1(B)
 T2: r2(B), w2(D)
 T3: r3(C), w3(A)
Consider a Timestamp Ordering scheduler named TO in which the three transaction
T1, T2, and T3 have timestamps 60, 55, and 70 respectively. Let the largest timestamp
in the database (across all data objects) be 50.Consider a Two-Phase Locking scheduler
named 2PL, also operating on the same set of data objects. Examine the following five
schedules:
S1: r1(A), r3(C), w3(A), r2(B), w2(D), w1(B)
S2: r3(C), r1(A), w1(B), r2(B), w2(D), w3(A)
S3: r2(B), r1(A), w2(D), r3(C), w1(B), w3(A)
S4: r3(C), r1(A), w3(A), r2(B), w1(B), w2(D)
S5: r1(A), r3(C), w1(B), r2(B), w3(A), w2(D)
Which one of the following statement is/are TRUE?
(a)TO cannot produce S2; 2PL can produce S2.
(b)TO can produce S5; 2PL can produce S5.
(c)TO cannot produce S1; 2PL cannot produce S1.
(d)TO can produce S2; 2PL can produce S2

BASIC DATABASE MANAGEMENT SYSTEM Page 68


Q49. Consider the set of transactions accessing database element A shown in the following
figure. These transactions are operating under an ordinary timestamp-based
scheduler.
T1 T2 T3 T4 A
150 200 175 225 RT=0
WT=0
r1(A) RT=150
w1(A) WT=150
r2(A) RT=200
w2(A) WT=200
r3(A)

r4(A) RT=225
Which of the following transaction will be aborted?
(a) T1 (b) T2 (c) T3 (d) T4

Q50. Consider the following two statements about database transaction schedules:
I. Strict two-phase locking protocol generates conflict serializable schedules that are
also recoverable.
II. Timestamp-ordering concurrency control protocol with Thomas’ Write Rule can
generate view serializable schedules that are not conflict serializable
Which of the above statements is/are TRUE?
(a) I only (b) II only (c) Both I and II (d) Neither I nor II

Q51. Consider the following statements:


i. All serial transactions are both conflict serializable and view serializable
ii. For any schedule, if it is view serializable, then it must be conflict serializable.
iii. Under 2PL protocol, there can be schedules that are not serial.
iv. Any transaction produced by 2PL must be conflict serializable.
v. Strict 2PL guarantees no deadlock.
(a) i and iii only (b) ii and iv only
(c) i, iv and v only (d) i, iii and iv only

BASIC DATABASE MANAGEMENT SYSTEM Page 69


Q52. Which of the following scenarios may lead to an irrecoverable error in a database
system?
(a) A transactions writes a data item after it is read by an uncommitted transaction
(b) A transaction reads a data item after it is written by an uncommitted transaction
(c) A transaction reads a data item after it is read by an uncommitted transaction
(d) A transaction reads a data item after it is written by a committed transaction.

Q53. Which of the following statements is/are true?


1. In a cascade-less schedule if a transaction Tj read a data item written by transaction
Ti then the commit of Ti has to be before this read operation of Tj.
2. A recoverable schedule is also cascade-less.
3. All conflict-serializable schedules are also in 2PL.
4. Every strict 2PL schedule is also 2PL
(a) 1, 3 and 4 Only
(b) 1 and 3 only
(c) 2, 3 and 4 only
(d) 1 and 4 only

Q54. Which of the following is/are true about 2PL?


1. In 2PL locking, once a lock is released by the transaction it cannot acquire any new
locks.
2. Schedule under 2PL ensures conflict serializability.
3. Schedules produced by 2PL locking are guaranteed to prevent cascading roll
backing.
4. Strict 2PL locking is both necessary and sufficient to guarantee conflict
serializability
(a) 1 and 2 only (b) 2 and 3 only
(c) 3 and 4 only (d) 1, 2 and 4 only

Q55. Under the 2-phase locking protocol, which is true?


(a) Once a transaction has released a lock it cannot acquire any more locks
(b) A transaction can release all its locks when it commits
(c) A transaction can acquire all the locks it needs when it begins
(d) All of the above

BASIC DATABASE MANAGEMENT SYSTEM Page 70


Q56. Given a schedule for transactions T1 and T2, we can say that
(a) The schedule can be serialized if T1 and T2 resulted from the use of two-phase
locking
(b) The transactions compute the correct result if T1 executed only after T2 committed
(c) The transactions compute the correct result if T1 and T2 executed concurrently but
did not access any common data items
(d) All of the above statements are correct

Q57. Which of the following protocol is free from deadlock?


1. Basic two phase locking protocol
2. Strict two phase locking protocol
3. rigorous two phase locking protocol
4. Timestamp based protocol
(a) All the above (b) 2, 3 and 4 only
(c) 3 and 4 only (d) 4 only

Q58. Which of the following protocol is free from cascading rollbacks?


1. Basic two phase locking protocol
2. Strict two phase locking protocol
3. rigorous two phase locking protocol
4. Timestamp based protocol
(a) All the above
(b) 3 and 4 only
(c) 2 and 3 only
(d) 3 only

Data for the next three questions. Consider that, there are m transactions =
{T1,T2,…,Tm}and for each transaction Ti there are ni operations in it.It is required that the
relative ordering of operations within a transaction does not change.
Q59. How many possible schedules can be obtained with value of m = 3, n1 = 4, n2 = 3 and
n3 = 2?______

Q60. How many possible serial schedules can be obtained with value of m = 3, n1 = 3, n2 = 2
and n3 = 1?___________

Q61. How many possible non-serial schedules can be obtained with value of m = 3, n1 = 3, n2
= 2 and n3 = 1? ___________

BASIC DATABASE MANAGEMENT SYSTEM Page 71


Q62. Consider the following two transactions
T1: r(A),w(A)
T2: r(A),w(A)
How many serial schedules do exist for T1 and T2?__________

Q63. Consider the following two transactions


T1: r(A),w(A)
T2: r(B),w(B)
How many serializable schedules do exist for T1, T2, which are not serial ones?_______
Q64. Consider the following schedule:
S = r2(Y);w2(Y);r3(Y);r1(X);w1(X);w3(Y);r2(X);r1(Y);w1(Y);
How many serial order of transaction do exist for schedule S?__________

Q65. Two transactions T1 and T2 are given as


T1:r1(A), w1(A), r1(B), w1(B)
T2:r2(B), w2(B), r2(C), w2(C)
The total number of conflict serializable schedules that can be formed by T1 and T2 is
______
Q66. Assume an immediate database modification scheme. Consider the following log
consisting transactions T1, T2, T3 and T4:
1. (Start, T4)
2. (T4, Y, 2, 3)
3. (Start, T1)
4. (Commit, T4)
5. (T1, Z, 5, 7)
6. (Checkpoint)
7. (Start, T2)
8. (T2, X, 1, 9)
9. (Commit, T2)
10. (Start, T3)
11. (T3, Z, 7, 2)
We represent an update log record as (Ti , Xj , V1, V2), indicating that transaction Ti
has performed a write on data item Xj. Xjhad value V1 before the write, and has value
V2 after the write. If the database system crashes just after log record 11 is written and

BASIC DATABASE MANAGEMENT SYSTEM Page 72


the system try to recover using both undo and redo operations, what are the contents of
the undo list and the redo list?
(a) Undo: T3, T1; Redo: T2, T4
(b) Undo: none; Redo: T2, T4, T3; T1
(c) Undo: T3, T1; Redo: T2
(d) Undo: T3, T1, T4; Redo: T2

Q67. Assume an immediate database modification scheme. Consider the following log
sequence of two transactions:
1. (Start, T1)
2. (T1, B, 1200, 10000)
3. (T1,C, 0, 2000)
4. (Commit, T1)
5. (Start, T2)
6. (T2, B,10000, 10500)
7. (Commit, T2)
Suppose the database system crashes just before log record 7 is written. When the
system is restarted, which one statement is true of the recovery procedure?
(a) We must redo log record 6 to set B to 10500
(b) We must undo log record 6 to set B to 10000 and then redo log records 2 and 3
(c) We need not redo log records 2 and 3 because transaction T1 has committed
(d) We can apply redo and undo operations in arbitrary order because they are
idempotent

Q68. Assume an immediate database modification scheme. Consider the following log
consisting transactions T1, T2, and T3:
1. (Start, T1);
2. (T1, P, 500, 600);
3. (T1, Q, 400, 500);
4. (Commit, T1);
5. (Start, T2);
6. (T2, P, 600, 550);
7. (T2, Q, 500, 450);
8. (Commit, T2);
9. (Start, T3);

BASIC DATABASE MANAGEMENT SYSTEM Page 73


10. (T3, P, 550, 600);
11. (T3, Q, 450, 500);
12. (Commit, T3);
We represent an update log record as (Ti , Xj , V1, V2), indicating that transaction Ti
has performed a write on data item Xj. Xjhad value V1 before the write, and has value
V2 after the write. Which of the following statement is false?
(a) If the schedule crashes just after Step 3, then Undo(T1) is performed.
(b) If the schedule crashes just after Step 11, then after complete recovery process the
value of P=550 and Q=450
(c) If the schedule crashes just after Step 7, then recovery operations are performed
according to the order: Redo(T1), Undo(T2)
(d) None of the above
Q69. Assume an immediate database modification scheme. Consider the following log
consisting transactions T1, T2, T3 and T4:
1. (Start, T1)
2. (T1, A, 50, 25)
3. (T1, B, 250, 25)
4. (Start, T2)
5. (T1, A, 25, 50)
6. (T2, C, 55, 25)
7. (Commit, T1)
8. (Start, T3)
9. (T3, E, 65, 25)
10. (T2, D, 35, 25)
11. (Checkpoint)
12. (T2, C, 25, 55)
13. (Commit, T2)
14. (Start T4)
15. (T4, F, 120, 25)
We represent an update log record as (Ti, Xj, V1, V2), indicating that transaction Ti has
performed a write on data item Xj. Xj had value V1 before the write, and has value V2
after the write. If the database system crashes just after log record 15 is written, what
is the sum of all the data items A, B, C, D, E and F on disk after recovery?___________

BASIC DATABASE MANAGEMENT SYSTEM Page 74


ENTITY RELATIONSHIP MODEL
Q1. [MSQ]
Given the portion of an ER diagram shown below

Which of the following statements is/are true?


(a) R connects each entity in A to at least one entity in B
(b) R connects each entity in A to at most one entity in B
(c) R connects each entity in B to at least one entity in A
(d) R connects each entity in B to at most one entity in A

Q2. Consider the following ER Diagram Shown below:

The number of attribute of the relation customer if the above ERD is mapped into a
relation model which always satisfy 3NF?________
Q3. Consider the following ER Diagram Shown below:

Which of the following possible relations will hold if the above ERD is mapped into a
relation model which always satisfy 3NF?
1. employee (employee-id, employee-name, telephone-number, manger-id)
2. employee (employee-id, employee-name, telephone-number)
3. works-for (employee-id, manger-id)
(a) 1 only (b) 2 only (c) 2 and 3 only (d) Either a or c

BASIC DATABASE MANAGEMENT SYSTEM Page 75


Q4. Consider the following ER Diagram Shown below:

Which of the following possible relations will hold if the above ERD is mapped into a
relation model which always satisfy 3NF?
1. employee (employee-id, employee-name, telephone-number, manger-id)
2. employee (employee-id, employee-name, telephone-number)
3. works-for (employee-id, manger-id)
(a) 1 only
(b) 2 only
(c) 2 and 3 only
(d) Either a or c

Q5. Consider the following ER Diagram Shown below:

Which of the following possible relations will hold if the above ERD is mapped into a
relation model which always satisfy 3NF?
1. customer(customer-id, customer-name, customer-street, customer-city)
2. loan(loan-number, customer-id, amount)
3. customer(customer-id, lone-number, customer-name, customer-street, customer-
city)
4. loan(loan-number, amount)
5. borrower(customer-id, loan-number)
(a) 1 and 2 only
(b) 1 and 4 only
(c) 1, 4 and 5 only
(d) 3 and 4 only

BASIC DATABASE MANAGEMENT SYSTEM Page 76


Q6. Consider the following ER Diagram Shown below:

Which of the following is/are possible relations when the above ERD is mapped into a
relation model which always satisfy 3NF?
1. customer(customer-id, customer-name, customer-street, customer-city)
2. loan(loan-number, customer-id, amount)
3. customer(customer-id, lone-number, customer-name, customer-street, customer-
city)
4. loan(loan-number, amount)
5. borrower(customer-id, loan-number)
(a) 1 and 2 only
(b) 3 and 4 only
(c) 1, 4 and 5 only
(d) 1 and 4 only
Q7. Consider the following ER Diagram Shown below:

Which of the following is/are possible relations when the above ERD is mapped into a
relation model which always satisfy 3NF?
1. customer(customer-id, customer-name, customer-street, customer-city)
2. loan(customer-id, loan-number, amount)
3. customer(customer-id, loan-number, customer-name, customer-street, customer-
city)
4. loan(loan-number, amount)
5. borrower(customer-id, loan-number)
(a) 1 and 2 only (b) 3 and 4 only
(c) 1, 4 and 5 only (d) either a or b

BASIC DATABASE MANAGEMENT SYSTEM Page 77


Q8. Consider the following ER Diagram Shown below:

Which of the following is/are possible relations when the above ERD is mapped into a
relation model which always satisfy 3NF?
1. customer(customer-id, customer-name, customer-street, customer-city)
2. loan(loan-number, customer-id, amount)
3. customer(customer-id, loan-number, customer-name, customer-street, customer-
city)
4. loan (loan-number, amount)
5. customer-loan(customer-id, customer-name, customer-street, customer-city, loan-
number, amount)
(a) 1 and 2 only (b) 3 and 4 only (c) 5 only (d) either a or b

Q9. Consider the following ER Diagram Shown below:

Which of the following is/are possible relations when the above ERD is mapped into a
relation model which always satisfies 3NF?
1. customer(customer-id, customer-name, customer-street, customer-city)
2. loan(loan-number, customer-id, amount)
3. customer(customer-id, loan-number, customer-name, customer-street, customer-
city)
4. loan (loan-number, amount)
5. customer-loan(customer-id, customer-name, customer-street, customer-city, loan-
number, amount)
(a) 1 and 2 only (b) 3 and 4 only (c) 5 only (d) either a or b

BASIC DATABASE MANAGEMENT SYSTEM Page 78


Q10. Consider the following ER Diagram Shown below:

Which of the following is/are possible relations when the above ERD is mapped into a
relation model which always satisfies 3NF?
1. customer(customer-id, customer-name, customer-street, customer-city)
2. loan(loan-number, customer-id, amount)
3. customer(customer-id, loan-number, customer-name, customer-street, customer-
city)
4. loan (loan-number, amount)
5. customer-loan(customer-id, customer-name, customer-street, customer-city, loan-
number, amount)
(a) 1 and 2 only (b) 3 and 4 only
(c) 5 only (d) either a or b

Q11. Consider the following ER Diagram Shown below:

Which of the following is/are possible relations when the above ERD is mapped into a
relation model which always satisfies 3NF?
1. customer (customer-id, customer-name, customer-street, customer-city)
2. account (account-number, customer-id, balance)
3. customer (customer-id, account-number, customer-name, customer-street, customer-
city)
4. account (account-number, balance)
5. depositor (customer-id, account-number, access-date)
(a) 1 and 2 only (b) 3 and 4 only
(c) 1, 4 and 5 only (d) either a or b

BASIC DATABASE MANAGEMENT SYSTEM Page 79


Q12. Consider the following ER Diagram Shown below:

Which of the following possible relations will hold if the above ER Diagram is mapped
into a relation model which always satisfies 3NF?
1. loan(loan-number, amount)
2. payment(loan-number, payment-number, payment-date, payment-amount)
3. loan(loan-number, payment-number, amount)
4. payment(payment-number, payment-date, payment-amount)
5. loan-payment(loan-number, payment-number)
(a) 1 and 2 only (b) 3 and 4 only
(c) 1, 4 and 5 only (d) either a or b

For the next three questions, consider the following ER Diagram shown below:

Q13. Which of the following entity set in the relationship set represent total participation?
(a) customer (b) borrower (c) loan (d) None

Q14. Which type of mapping exists between customer-loan relationships?


(a) one-to-many (b) many-to one (c) many-to-many (d) one-to one

Q15. [MSQ]
Which of the following statements is/are TRUE about above ER?
1. Each customer can take more than one loan.
2. Each loan can have more than one customer.
3. Each customer can take only one loan.
4. Each loan must have exactly one customer.
5. Each customer must have at least one loan.

BASIC DATABASE MANAGEMENT SYSTEM Page 80


Q16. Suppose a relationship R has a mapping cardinality of type many to many between the
entities E1 and E2. Let the entity set El has 2 entities and E2 with 3 entities. Also that
both El and E2 has partial participation in relationship. What are the minimum and
the maximum number of instances of the relationship type R?
(a) A min of 2 and a max of 3
(b) A min of 0 and a max of 6
(c) A min of 0 and a max of 3
(d) A min of 2 and a max of 6

Q17. Suppose a relationship R has a mapping cardinality of type many to many between the
entities E1 and E2. Let the entity set El has 2 entities and E2 with 3 entities. Also that
El has total participation and E2 has partial participation in relationship. What is the
minimum and the maximum number of instances of the relationship type R?
(a) A min of 2 and a max of 3
(b) A min of 0 and a max of 6
(c) A min of 0 and a max of 3
(d) A min of 2 and a max of 6

Q18. Suppose a relationship R has a mapping cardinality of type one to many between the
entities E1 and E2. Let the entity set El has 2 entities and E2 with 3 entities. Also that
both El and E2 has partial participation in relationship. What are the minimum and
the maximum number of instances of the relationship type R?
(a) A min of 2 and a max of 3
(b) A min of 0 and a max of 6
(c) A min of 0 and a max of 3
(d) A min of 2 and a max of 6

Q19. Suppose a relationship R has a mapping cardinality of type one to many between the
entities E1 and E2. Let the entity set El has 2 entities and E2 with 3 entities. Also that
El has total participation and E2 has partial participation in relationship. What are the
minimum and the maximum number of instances of the relationship type R?
(a) A min of 2 and a max of 3
(b) A min of 0 and a max of 6
(c) A min of 0 and a max of 3
(d) A min of 2 and a max of 6

BASIC DATABASE MANAGEMENT SYSTEM Page 81


Q20. Consider the following ER-model:

The minimum number of relations that would be generated if all the relations are in
3NF is _________.

Q21. Which statement is NOT consistent with the following ER diagram?

Consider that an instance of the "Orders" relationship is called an Order.


(a) A customer may place two orders for different books.
(b) There are books that have not been ordered by any customer.
(c) A customer may place two orders for the same book.
(d) There is a book that has 1000 orders from customers.

BASIC DATABASE MANAGEMENT SYSTEM Page 82


Q22. Consider the following ER-model:

The minimum number of relations that would be generated if all the relations are in
3NF is __________.
Q23. Consider the following ER-model:

The minimum number of relations that would be generated if all the relations are in
3NF is __________.

BASIC DATABASE MANAGEMENT SYSTEM Page 83


Q24. Consider the following ER-model:

The minimum number of relations that would be generated if all the relations are in
3NF is __________.

BASIC DATABASE MANAGEMENT SYSTEM Page 84

You might also like