DBMS Basic Sheet
DBMS Basic Sheet
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
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)
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);
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));
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.
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);
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');
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
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));
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);
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);
For next ten questions, consider the following relation table and their schemas, where primary keys
are underlined.
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
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
Data for next five questions, consider the following snapshot of relation table and their schemas,
where primary keys are underlined.
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);
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
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
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
Q87. Consider the following relational algebra query is executed on the above instance:
Q90. Consider the following relational algebra query is executed on the above instance:
Q92. Consider the following tuple relational calculus query is executed on the above instance:
Q93. Consider the following tuple relational calculus query is executed on the above instance:
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:
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
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
Which of the following FDs are satisfied for the above relation instance?
(a) BC → A (b) AC → B
(c) E → ABCD (d) D → A
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
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.
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
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
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? ________
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? ______
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
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 {ABC,
BCD, AB}. Which of the following statements is/are true?
(a) BC is a member of F+ (b) ABCD is a member of F+
(c) CDCD 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.
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.
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, CD}. How many attributes of R is prime
attributes? ________
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,
BA, CB}.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.
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 {ABC, BCD, AB}.
Which FD has an extraneous attribute on the left hand side?
(a) ABC (b) BCD
(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
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}
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.
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?________
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
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.
Q5. The index blocking factor bfri (which is also the index fan-out fo) is________
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________
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____
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_________
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______
Q26. The number of leaf-level blocks needed if blocks are at most 70% full 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
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
_______________
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.”____________
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?
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?
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
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)
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__________
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
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?__________
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
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
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
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.
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
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
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
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
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
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? ___________
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);
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
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
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
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
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
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
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
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
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
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.
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
The minimum number of relations that would be generated if all the relations are in
3NF is _________.
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 __________.
The minimum number of relations that would be generated if all the relations are in
3NF is __________.