Databases
Databases
DATABASES
YEAR 2000
Q. 1
ONE MARK
Q. 2
TWO MARKS
Given relations r (w, x) and s (y, z), the result of select distinct w, x
from r, s :
is guaranteed to be same as r, provided :
(A) r has no duplicates and s is non empty
(B) r and s have no duplicates
(C) s has no duplicates and r is non empty
(D) r and s have the same number of tuples
YEAR 2001
Q. 4
mywbut.com
ONE MARK
DATABASES
Q. 5
Q. 6
Let r and s be two relations over the relation schemes R and S respectively, and
let A be an attribute in R. Then the relational algebra expression sA = a ]r A s g is
always equal to :
(A) sA = a ]r g
(B) r
(C) sA = a ]r A s g
(D) None of the above
YEAR 2001
TWO MARKS
Q. 7
R,(A,B,C,D) is a relation. Which of the following does not have a lossless join,
dependency preserving BCNF decomposition ?
(A) A " B, B " CD
(B) A " B, B " C, C " D
(C) AB " C, C " AD
(D) A " BCD
Q. 8
Q. 9
Consider a relation geq which represents greater than or equal to, that is,
(x, y) ! geq only if y # x:
Create table gaq
(
Ib integer not null
ub integer not null
primary key Ib
foreign key (ub) references geq on delete cascade):
Which of the following is possible if a tuple (x, y) is deleted ?
(A) A tuple (z, w) with z > y is deleted (B) A tuple (z, w) with z > x is deleted
(C) A tuple (z, w) with w < x is deleted (D) The deletion of (x, y) is prohibited
YEAR 2002
Q. 10
mywbut.com
ONE MARK
DATABASES
Q. 11
With regard to the expressive power of the formal relational query languages,
which of the following statements is true ?
(A) Relational algebra is more powerful than relational calculus.
(B) Relational algebra has the same power as relational calculus.
(C) Relational algebra has the same power as safe relational calculus.
(D) None of the above.
Q. 12
AB+ -tree index is to be built on the Name attribute of the relation STUDENT
. Assume that all student names are of length 8 bytes, disk blocks are of size 512
bytes, and index pointers are of size 4 bytes. Given this scenario, what would be
the best choice of the degree (i.e. the number of pointers per node) of the B+ -tree
(A) 16
(B) 42
(C) 43
(D) 44
Q. 13
Q. 14
From the following instance of relation schema R (A, B, C), we can conclude that :
A
2
(A)
(B)
(C)
(D)
3 2
A functionally determines B and B functionally determines C
A functionally determines B and B does not functionally determines C .
B does not functionally determines C
A does not functionally B and B does not functionally determines.
YEAR 2003
Q. 15
mywbut.com
ONE MARK
Q. 16
DATABASES
(B)
(C)
(D)
a1, a2,... an
a1, a2,... an
a1, a2,... an
YEAR 2003
TWO MARKS
Q. 17
Q. 18
Consider the set of relations shown below and the SQL query that follow:
Students:(Roll_number,Name,Date_of_birth)
Courses:(Course_number,Course_name,Instructor)
Grades:(Roll_number,Course_number,Grade)
select distrinct Name
from Students, Courses, Grades
Where Students,Roll_number=Grades. Toll_number
and Courses. Instructor=Korth
and Courses. Course_number=Grades. Course_number
and Grades.grade=A
Which of the following sets is computed by the above query?
(A) Names of students who have got an A grade in all courses taught by Korth
(B) Names of students who have got an A grade in all courses
(C) Name of students who have got an A grade in at least one of the courses
taught by Korth
(D) None of the above
mywbut.com
Q. 19
DATABASES
Consider three data items D1,D2 and D3 and the following execution schedule of
transactions T1, T2 and T3. In the diagram, R (D) and W (D) denote the actions
reading and writing the data item D respectively.
T1
T2
T3
R(D3);
R(D2);
R(D2);
R(D2);
R(D3);
R(D1);
R(D1);
W(D2);
W(D3);
R(D1);
R(D2);
W(D2);
W(D1);
(A) The schedule is serializable as T2; T3;T1;
(B) The schedule is serializable as T2; T1;T3;
(C) The schedule is serializable as T3; T2; T1;
(D) The schedule is not serializable
YEAR 2004
Q. 20
Let R1 (A, B, C) and R2 (D, E) be two relation schema, where the primary keys are
shown underlined, and let C be a foreign key in R1 referring to R2 . Suppose there
is no violation of the above referential integrity constraint in the corresponding
relation instances r1 and rl2. Which one of the following relational algebra
expressions would necessarily produce an empty relation?
(B) PC (r1) - PD (r1)
(A) PD (r1) - PC (r1)
(C) PD (r1 D C ! D R2) - PC (r1)
Q. 21
mywbut.com
ONE MARK
DATABASES
YEAR 2004
Q. 22
TWO MARKS
The relation scheme student Performance (name, courselNo, rollNo, grade) has
the following functional dependencies:
name, courseNo "grade
RollNo, courseNo "grade
name "rollNo
rollNo "name
The highest normal form of this relation scheme is
(A) 2 NF
(B) 3NF
(C) BCNF
(D) 4 NF
Q. 24
Consider the relation Student (name, sex, marks), where the primary key is
shown underlined, pertaining to students in a class that has at least one boy and
one girl. What does the following relational algebra expression produce?
Pname (rsex = females (Student)) Pname (Student
A
rn, x, m (student))
(sex = female
/ x = male
/ marks # m)
(A) names of
(B) names of
(C) names of
(D) names of
mywbut.com
*Shipping Free*
DATABASES
Q. 25
Q. 26
ONE MARKS
Q. 27
Which one of the following is a key factor for preferring B+ -trees to binary search
trees for indexing database relation?
(A) Database relations have a large number of record
(B) Database relations are sorted on the primary key
(C) B+ -trees require less memory than binary search trees
(D) Data transfer from disks is in blocks
Q. 28
Q. 29
mywbut.com
YEAR 2005
DATABASES
TWO MARKS
Q. 30
Q. 31
The following table has two attributes A and C where A is the primary key and
C is the foreign key referencing A with on-delete cascade.
A
2
3
4
5
7
9
6
C
4
4
3
2
2
5
4
The set of all tuples that must be additionally deleted to preserve referential
integrity when the tuple (2,4) is deleted is:
(A) (3,4) and (6,4)
(B) (5,2) and (7,2)
(C) (5,2)(7,2) and (9,5)
(D) 1
Q. 32
The relation book (title, price) contains the titles and prices of different books.
Assuming that no two books have the same price, what does the following SQL
select title
from book as B
where (select count(*)
from book as T
where T. price>B.Price)<5
(A) Titles of the four most expensive books
(B) Title of the fifth most inexpensive book
(C) Title of the fifth most expensive book
(D) Titles of the five most expensive books
Q. 33
mywbut.com
YEAR 2006
Q. 34
DATABASES
ONE MARK
Consider the following log sequence of two transactions on a bank account, with
initial balance 12000,that transfer 2000 to a mortgage payment and, then apply
a 5% interest.
1. T1 start
2. T1 B old = 12000 new = 10000
3. T1 M old = 0 ne = 2000
4. T1 commit
5. T2 start
6. T2 B old = 10000 new = 10500
7. T2 commit
Suppose the database system crashed 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
YEAR 2006
TWO MARKS
Q. 35
Q. 36
Consider the relation enrolled (student, course) in which student, course) is the
primary key, and the relation paid (student, amount) where student is the primary
key . Assume no null values and no foreign keys or integrity constraints. Given
the following four queries:
mywbut.com
DATABASES
Query 1: Select from enrolled where student in (select student form paid)
Query 2: Select student from paid where student in (select student from enrolled)
Query 3: Select E. student from enrolled E, paid P where E. student= P student
Query 4: Se3lect student from paid where exists (select*from enrolled where
enrolled student=paid.student
Which one of the following statements is correct?
(A) All queries return identical row sets for any database
(B) Query 2 and Query 4 return identical row sets for all databases but there
exist database for which Query 1 and Query 2 retrun different row sets
(C) There exist databases for which Query 3 returns strictly fewer rows than
Query 2
(D) There exist databases for which Query 4 will encounter an intergrity
violation at runtime
Q. 37
A disk seek takes 4 ms . disk data transfer bank width is 300 MB/s and checking
a tuple to see if amount is greater x takes 10 ms . Which of the following statements
is correct?
(A) Plan 1 and Plan 2 will not output identical row sets for all databases
(B) A course may be listed more than once int the output of Plan 1 for some
databases
(C) For x = 5000, Plan 1 executes faster than Plan 2 for all databases
(D) For x = 9000, Plan 1 executes slower than Plan 2 for all databases
Q. 38
mywbut.com
YEAR 2007
DATABASES
TWO MARKS
Q. 39
Q. 40
Consider the relation employee (name, sex, supervisorName (with name as the
key. supervisor Name-gives the name of the supervisor of the employee under
consideration. What does the following Tuple Relational Calculus query produce?
{e.name|employee(e) 0
(6 #)[Jemployee (x) 0 x.supervisorName
! e.name 0 x.sex = "male"]}
(A) Names of employees with a male supervisor
(B) Names of employees with no immediate male subordinates
(C) Names of employees with no immediate female subordinates
(D) Names of employees with a female supervisor
Q. 41
Consider the table employee (empId, name, department, salary) and the two
queries Q1, Q2 below. Assuming that department 5 has more than one employee,
and we want to find the employees who get higher salary than anyone in the
department 5, which one of the statements is TRUE for any arbitrary employee
table?
Q1 : Select e. empId
From employee e
Where not exists
(Select*From employee s Where s. department=5 and s.salay>=e.salary)
Q.2 : Select e. empId
From employee e
Where e.salary>Any
(Select distinct salary From employee s Where s. department=5)
(A) Q1 is the correct query.
(B) Q2 is the correct query
(C) Both Q1 and Q2 produce the same answer
(D) Neither Q1 nor Q2 is the correct query
Q. 42
mywbut.com
DATABASES
Q. 43
The order of a leaf node in a B+ -tree is the maximum number of (value, data
record pointer) pairs it can hold. Given that the block size is 1K bytes, data
record pointer is 7 bytes long, the value field is 9 bytes long and a block pointer
is 6 bytes long, what is the order of the leaf node?
(A) 63
(B) 64
(C) 67
(D) 68
Q. 44
Consider the following schedules involving two transactions. Which one of the
following statements is TRUE?
S1:r1 (X); r1 (Y); r2 (X); r2 (Y); w2 (Y); w1 (X)
S2:r1 (X); r2 (X); r2 (Y); w2 (Y); r1 (Y); w1 (X)
(A) Both S1 and S2 are conflict serializable
(B) S1 is conflict serializable and S2 is not conflict serializable
(C) S1 is not conflict serializable and S2 is conflict serializable
(D) Both S1 and S2 are not conflict serializable
YEAR 2008
Q. 45
ONE MARK
TWO MARKS
Q. 46
Q. 47
mywbut.com
DATABASES
Consider a file of 1684 records. Each record is 32 bytes long and its key field is
of size 6 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 1024 bytes, and
the size of a block pointer is 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 number of first-level and second-level blocks in the multi-level index
are respectively
(A) 8 and 0
(B) 128 and 6
(C) 256 and 4
(D) 512 and 5
Q. 48
Q. 49
Q. 50
Which of the following is a correct attribute set for one of the tables for the
correct answer to the above question?
(A) {M1,M2,M3,P1}
(B) {M1,P1,N1,N2}
(C) {M1,P1,N1}
(D) {M1,P1}
YEAR 2009
Q. 51
TWO MARKS
Consider two transactions T1 and T2 and four schedules S1, S2, S3, S4 of T1 and T2 as
given below :
T1: R1 [x] W1 [x] W1 [y]
T2: R2 [x] R2 [y] W2 [y]
S1: R1 [x] R2 [x] R2 [y] W1 [x] W1 [y] W2 [y]
S2: R1 [x] R2 [x] R2 [y] W1 [x] W2 [y] W1 [y]
S3: R1 [x] W1 [x] R2 [x] W1 [y] R2 [y] W2 [y]
S4: R2 [x] R2 [y] R1 [x] W1 [x] W1 [y] W2 [y]
Which of the above schedules are conflict-serializable?
(A) S1 and S2
(B) S2 and S3
(C) S3 only
(D) S4 only
Q. 52
mywbut.com
The following key values are inserted into a B + -tree in which order of the
internal nodes is 3, and that of the leaf nodes is 2, in the sequence given below.
The order of internal nodes is the maximum number of tree pointers in each node,
and the order of leaf nodes is the maximum number of data items that can be
stored in it. The B + -tree is initially empty.
10,3,6,8,4,2,1
DATABASES
The maximum number of times leaf nodes would get split up as a result of these
insertions is
(A) 2
(B) 3
(C) 4
(D) 5
Let R and S be relation schemes such that R = {a, b, c} and S = {c}. Now consider
the following queries on the database :
I.
pR - S (r) - pR - S (pR - S (r) # S - pR - S, S (r))
II.
{t | t ! pR - S (r) / 6u ! s (7v ! r (u = v [s] / t = v [R - S]))}
III.
{t | t ! pR - S (r) / 6v ! r (7u ! s (u = v [s] / t = v [R - S]))}
IV.
Select R.a, R.b
From R, S
Where R.c = S.c
Which of the above queries are equivalent?
(A) I and II
(B) I and III
(C) II and IV
(C) III and IV
Q. 53
Q. 55
Assume that, in the suppliers relation above, each supplier and each street within
a city has a unique name, and (same, city) forms a candidate key. No other
functional dependencies are implied other than those implied by primary and
candidate keys. Which one of the following is TRUE about the above schema ?
(A) The schema is in BCNF.
(B) The schema is in 3NF but not in BCNF.
(C) The schema is in 2NF but not in 3NF.
(D) The schema is not in 2NF.
mywbut.com
DATABASES
YEAR 2010
ONE MARK
Q. 56
Q. 57
pname
Age
Sachin
65
Rahul
66
Sourav
67
Anil
69
Table : Reservation
pid class
tid
AC
8200
AC
8201
SC
8201
AC
8203
SC
8204
AC
8202
What pids are returned by the following SQL query for the above instance of the
tables ?
SELECT pid
FROM Reservation
WHERE class= AC AND
EXISTS (SELECT)
FROM Passenger
WHERE age>65 AND
Passenger.pid = Reservation.pid)
(A) 1,0
(C) 1, 3
Q. 58
mywbut.com
(B) 1, 2
(D) 1, 5
YEAR 2010
DATABASES
TWO MARKS
Q. 59
Q. 60
The following functional dependencies hold for relations R(A,B,C) and S(B,D,E):
B"A
A"C
The relation R contains 200 tuples and the relation S contains 100 tuples. What
is the maximum number of tuples possible in the natural join R D S ?
(A) 100
(B) 200
(C) 300
(D) 2000
YEAR 2011
Q. 61
mywbut.com
ONE MARK
Consider a relational table with a single record from each registered student with
the following attributes.
1. Registration_Num: Unique registration number of each registered student
2. UID: Unique identity number, unique at the national level for each citizen
3. BankAccount_Num: Unique account number at the bank. A student can
have multiple accounts or joint accounts. This attribute stores the primary
account number.
4. Name: Name of the student
5. Hostel_Room: Room number of the hostel
Which of the following options is INCORRECT?
(A) BandAccount_Num is a candidate key
(B) Registration_Num can be a primary key
(C) UID is a candidate key if all students are from the same country
(D) If S is a superkey such that S + UID is NULL the S , UID is also a
superkey
DATABASES
YEAR 2011
TWO MARKS
Q. 62
Consider a database table T containing two columns X and Y each of type integer.
After the creation of the table, one record (X=1, Y=1) is inserted in the table.
Let MX and MY denote the respective maximum values of X and Y among all
records in the table at any point in time. Using MX and MY, new records are
inserted in the table 128 times with X and Y values being MX + 1, 2*MY + 1
respectively. It may be noted that each time after the insertion, values of MX and
MY change.
What will be the output of the following SQL query after the steps mentioned
above are carried out?
SELECT Y FROM T WHERE X = 7;
(A) 127
(B) 255
(C) 129
(D) 257
Q. 63
Bank_Manager
Loan_Amount
Ramesh
Sunderajan
10000.00
Suresh
Ramgopal
5000.00
Mahesh
Sunderajan
7000.00
What is the output of the following SQL query?
SELECT count(*)
FROM (
(SELECT Borrower, Bank_Manager FROM Loan_Records)
AS S NATURAL JOIN
SELECT Bank-Manager, Loan_Amount FROM Loan_Records)
AST
);
(A) 3
(B) 9
(C) 5
(D) 6
YEAR 2012
ONE MARK
Q. 64
Q. 65
Given the basic ER and relational models, which of the following is INCORRECT?
(A) An attribute of an entity can have more than one value
(B) An attribute of an entity can be composite
(C) In a row of a relational table, an attribute can have more than one value
(D) In a row of a relational table, an attribute can have exactly one value or a
NULL value
mywbut.com
DATABASES
Q. 66
TWO MARKS
YEAR 2012
Consider the following transactions with data items P and Q initialized to zero:
T1: Read (P);
red (0);
Q. 67
if P = 0 then Q: = Q + 1;
write (Q);
T2: read (0);
read (P);
if Q = 0 then P: = P + 1;
write (P);
Any non-serial interleaving of T1 and T2 for concurrent execution leads to
(A) a serializable schedule
(B) a schedule that is no conflict serializable
(C) a conflict serializable schedule
(D) a schedule for which a precedence graph cannot be drawn
Suppose R1 ^A, B h and R2 ^C, D h are two relation schemes. Let r1 and r2 be the
corresponding relation instances. B is a foreign key that refers to C in R2. If
data in r1 and r2 satisfy referential integrity constraints, which of the following
is ALWAYS TRUE?
(B) PC ^r2h - P B ^r1h = Q
(A) P B ^r1h - PC ^r2h = Q
(C) P B ^r1h = PC ^r2h
(D) P B ^r1h - PC ^r2h =
Y Q
Q. 68
mywbut.com
Id
Name
Age
12
Arun
60
15
Shreya
24
99
Rohit
11
DATABASES
B.
Id
Name
Age
15
Shreya
24
25
Hari
40
98
Rohit
20
99
Rohit
11
Id
Phone
Age
10
2200
02
99
2100
01
C.
Q. 69
How many tuples does the result of the following relational algebra expression
contain? Assume that the schema of A , B is the same as that of A.
^A , B h A A.Id > 40 0 C.Id < 15 C
(A) 7
(B) 4
(D) 9
(C) 5
Q. 70
How many tuples does the result of the following SQL query contain?
SELECT A.Id
FROM A
WHERE A.Age>
All (SELECT B.Age
FROM B
WHERE B.Name=Arun)
(A) 4
(B) 3
(C) 0
(D) 1
**********
mywbut.com
DATABASES
ANSWER KEY
Databases
1
10
(C)
(B)
(A)
(C)
(C)
(C)
(D)
(C)
(C)
(A)
11
12
13
14
15
16
17
18
19
20
(C)
(D)
(C)
(B)
(D)
(A)
(D)
(C)
(D)
(A)
21
22
23
24
25
26
27
28
29
30
(A)
(A)
(B)
(D)
(C)
(D)
(D)
(C)
(C)
(B)
31
32
33
34
35
36
37
38
39
40
(C)
(D)
(D)
(C)
(C)
(A)
(C)
(C)
(D)
(C)
41
42
43
44
45
46
47
48
49
50
(B)
(D)
(B)
(C)
(A)
(C)
(C)
(C)
(A)
(A)
51
52
53
54
55
56
57
58
59
60
(B)
(C)
(C)
(A)
(A)
(B)
(C)
(B)
(A)
(A)
61
62
63
64
65
66
67
68
69
70
(A)
(A)
(C)
(C)
(C)
(A)
(B)
(A)
(A)
(B)
mywbut.com