DBMS MCQs
DBMS MCQs
read (x) ; x : = x – 50; write (x) ; read (y); y : = y + 50 ; write (y)The constraint that the sum of
the accounts x and y should remain constant is that of
A : Atomicity
B : Consistency
C : Isolation
D : Durability
Consider a simple checkpointing protocol and the following set of operations in the log :
(Start , T4) ; (write , T4,y,2,3) ; (Start ,T1); (commit , T4);(write , T1,z,5,7);
(checkpoint);
(Start , T2);(write ,T2,x,1,9);(commit ,T2) ; (start T3),(write,T3,z,7,2);
If a crash happens now and the system tries to recover using both undo and redo
operations, what are the contents of the undo lists and the redo list?
A : Undo T3,T1; Redo T2
B : Undo T3,T1; Redo T2,T4
C : Undo: none; redo:T2,T4,T3,T1
D : Undo T3,T1; T4; Redo:T2
Consider the relation X(P,Q,R,S,T,U) with the following set of functional dependencies
F{
{ P,R } -> {S,T}
{P,S,U} -> {Q,R}
}
Which of the following is the trivial functional dependency in F+, where F+ is closure of F?
A : {P,R} -> {S,T}
B : {P,R} -> {R,T}
C : {P,S} -> {S}
D : {P,S,U} -> {Q}
Consider the following partial Schedule S involving two transactions T1 and T2. Only the
read and write operations have been shown. The read operation on data item P is denoted
by read(P) and the write operation on data item P is denoted by write(P).
Suppose that the transaction T1 fails immediately after time instance 9. Which one of the
following statements is correct?
A : T2 must be aborted and then both T1 and T2 must be re-started to ensure transaction
atomicity
B : Schedule S is non-recoverable and cannot ensure transaction atomicity
C : Only T2 must be aborted and then re-started to ensure transaction atomicity
D : Schedule S is recoverable and can ensure atomicity and nothing else needs to be done
Consider the following four schedules due to three transactions (indicted by the subscript)
using read and write on a data item x, denoted r (x) and w (x) respectively. Which one of
them is conflict serializable?
A : r1 (x) ; r2 (x) ; w1 (x) ; r3(x) ; w2 (x)
B : r2 (x) ; r1 (x) ; w2 (x) ; r3(x) ; w1 (x)
C : r3 (x) ; r2 (x) ; r1 (x) ; w2(x) ; w1 (x)
D : r2 (x) ; w2 (x) ; r3 (x) ; r1(x) ; w1 (x)
SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of
tuples in the result of joins. Which one of the following queries always gives the same
answer as the nested query shown below:
Select * from R where a in (select S. a from S)
A : Select R. * from R, S where R. a=S. a
B : Select distinct R. * from R,S where R. a=S. a
C : Select R. * from R, (select distinct a from S) as S1 where R. a=S1.a
D : Select R. * from R, S where R.a = S. a and is unique R
Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below.
T1 : r1 (X) ; r1 (z) ; w1 (X) ; w1 (z)
T2 : r2 (X) ; r2 (z) ; w2 (z)
T3 : r3 (X) ; r3 (X) ; w3 (Y)
S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z)
Which one of the following statements about the schedules is TRUE?
A : Only S1 is conflict-serializable
B : Only S2 is conflict-serializable.
C : Both S1 and S2 are conflict-serializable.
D : Neither S1 nor S2 is conflict-serializable.
Consider the following relational schema:
Employee (empId, empName, empDept )
Customer (custId,custName, salesRepId, rating)
SalesRepId is a foreign key referring to empId of the employee relation. Assume that each
employee makes a sale to at least one customer. What does the following query return?
SELECT empName
FROM employee E
WHERE NOT EXISTS (SELECT custId
FROM customer C
WHERE C. salesRepId = E. empId
AND C. rating < > ‘GOOD’)
A : Names of all the employees with at least one of their customers having a ‘GOOD’ rating.
B : Names of all the employees with at most one of their customers having a ‘GOOD’ rating.
C : Names of all the employees with none of their customers having a ‘GOOD’ rating.
D : Names of all the employees with all their customers having a ‘GOOD’ rating.
Consider a relational table with a single record for each registered student with the
following attributes.
1. Registration_Number: Unique registration number for each registered student
2. UID: Unique Identity number, unique at the national level for each citizen
3. BankAccount_Number: Unique account number at the bank. A student can have multiple
accounts or joint accounts. This attributes 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 : BankAccount_Number is a candidate key
B : Registration_Number 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 then S ? UID is also a superkey
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=l) 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
Which of the following statements are TRUE about an SQL query?
P : An SQL query can contain a HAVING clause even if it does not have a GROUP BY clause
Q : An SQL query can contain a HAVING clause only if it has GROUP BY clause
R : All attributes used in the GROUP BY clause must appear in the SELECT clause
S : Not all attributes used in the GROUP BY clause need to appear in the SELECT clause
A : P and R
B : P and S
C : Q and R
D : Q and S
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
Consider the following transactions with data items P and Q initialized to zero:
T1 : read (P) ;
read (Q) ;
if P = 0 then Q : = Q + 1 ;
write (Q).
T2 : read (Q) ;
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 not conflict serializable
C : a conflict serializable schedule
D : a schedule for which precedence graph cannot be drawn
An index is clustered, if
A : it is on a set of fields that form a candidate key
B : it is on a set of fields that include the primary key
C : the data records of the file are organized in the same order as the data entries of the
index
D : the data records of the file are organized not in the same order as the data entries of the
index
Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. F ={CH ->
G, A ->BC, B->CFH, E->A, F->EG} is a set of functional dependencies (FDs) so that F+ is exactly
the set of FDs that hold for R
How many candidate keys does the relation R have?
A:3
B:4
C:5
D:6
Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. F ={CH ->
G, A ->BC, B->CFH, E->A, F->EG} is a set of functional dependencies (FDs) so that F+ is exactly
the set of FDs that hold for R
The relation R is
A : in INF, but not in 2NF
B : in 2NF, but not in 3NF
C : in 3NF, but not in BCNF
D : in BCNF
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 = R1[X] R2[Y]R2[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
Consider the following relational schema:
Suppliers(sid:integer, sname:string, city:string, street:string)
Parts(pid:integer, pname:string, color:string)
Catalog(sid:integer, pid:integer, cost:real)
Consider the following relational query on the above database:
SELECT S.sname
FROM Suppliers S
WHERE S.sid NOT IN (SELECT C.sid
FROM Catalog C
WHERE C.pid NOT IN (SELECT P.pid
FROM Parts P
WHERE P.color<> 'blue'))
Assume that relations corresponding to the above schema are not empty. Which one of the
following is the correct interpretation of the above query?
A : Find the names of all suppliers who have supplied a non-blue part.
B : Find the names of all suppliers who have not supplied a non-blue part.
C : Find the names of all suppliers who have supplied only blue parts
D : Find the names of all suppliers who have not supplied only blue parts.
Which of the following concurrency control protocols ensure both conflict serialzability and
freedom from deadlock?
I. 2-phase locking
II. Time-stamp ordering
A : I only
B : II only
C : Both I and II
D : Neither I and II
Which of 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 of R and S (R natural join S)
A : 100
B : 200
C : 300
D : 2000
Let E1 and E2 be two entities in an E/R diagram with simple single-valued attributes. R1 and
R2 are two relationships between E1 and E2, where R1 is one-to-many and R2 is many-to-
many. R1 and R2 do not have any attributes of their own. What is the minimum number of
tables required to represent this situation in the relational model?
A:2
B:3
C:4
D:5
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 query list?
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 bookTitles of the five most expensive books
D : Titles of the five most expensive books
7. The following language used by most of the DBMSs for helping their users to access
data
(A) High level language
(B) Query language
(C) SQL
(D) 4GL
12. Need to see all the information from two tables on one form. Insert
(A) A page break
(B) A subform
(C) A linked command button
(D) None of the above
13. What is the primary difference between a pivot table report and a cross tab query?
(A) A pivot table report can contain sums, counts, and averages while a cross tab query
cannot.
(B) You can’t pivot a cross tab query
(C) A cross tab query lets you group similar items. A pitot table report does not
(D) None of above
17. Which field allow to select items from drop down list?
(A) An OLE field (B) A Memo Field
(C) A lookup Field (D) A hyperlink field
30. A form that is used to collect data in a structured manner for entry to a database is
called a
(A) Database deign form
(B) Systems flowchart
(C) Data capture form
(D) None of above
41. Different levels of access are assigned to personnel records in the health and fitness
gym. Only the system manager is able to create delete or edit records. Certain other
personnel are allowed to view all the records, whereas others are not permitted to view
complete records. The levels of access are controlled by
(A) Password (B) User id’s
(C) Status (D) None of the above
56. When a customer makes an online hotel booking, the database is updated in
(A) Batch mode (B) Pseudo real-time
(C) One month (D) All of above
58. The use of integrated collections of database records and files for data storage and
processing. The best fit for answer:
(A) Database management approach
(B) DBMS uses
(C) Database administrator
(D) Query language
96. Which of the following criterion would find records whose personality field does not
equal “Nice”?
(A) <>Nice (B) NOT Nice
(C) <>”Nice” (D) IS NOT Nice
98. Which of the following fields would not make a suitable primary key ?
(A) A date field
(B) An invoice number
(C) An autoNumber field
(D) A customer’s social security number
102. A notation for defining the form and structure of data is known as
(A) Data description language
(B) Binary language
(C) Data channels
(D) Data definition language
104. Which of the following terms refers to the degree to which data in database system
are accurate and correct?
(A) Data security (B) Data validaity
(C) Data independence (D) Data integrity
106. A set of programs that handle firm’s data base responsibilities is called a
(A) Database Management System (DBMS)
(B) Database Processing System (DBPS)
(C) Data Management System (DMS)
(D) All of above
108. Which is used to provide the sight information to the right person at the right
time for proper decision making ?
(A) DBMS (B) MIS
(C) ISO (D) PSO