Databases - Online Test

Q1. Which one of the following well formed formulae is tautology?
Answer : Option C
Explaination / Solution:



Q2. Which of the following is NOT a super key in a relational schema with attributes V , W , X , Y , Z and primary key V Y ?
Answer : Option B
Explaination / Solution:

Any superset of VY is a super key.

Q3. Which one of the following is NOT a part of the ACID properties of database transactions?
Answer : Option D
Explaination / Solution:

‘D’ means durability not deadlock freedom.

Q4.  A database of research articles in a journal uses the following schema. (VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, YEAR, PRICE) 
The primary key is (VOLUME, NUMBER, STARTPAGE, ENDPAGE) and the following functional dependencies exist in the schema.
(VOLUME, NUMBER, STARTPAGE, ENDPAGE)  → TITLE 
(VOLUME, NUMBER                                              → YEAR 
(VOLUME, NUMBER, STARTPAGE, ENDPAGE)  → PRICE
The database is redesigned to use the following schemas. 
(VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, PRICE) (VOLUME, NUMBER, YEAR) 
Which is the weakest normal form that the new database satisfies, but the old one does not?
Answer : Option A
Explaination / Solution:

candidate key is (volume, number, start page, end page) (Volume number) → year is a partial dependency. So original table is in 1NF but not in 2NF

Q5. The statement (¬p) ⇒ (¬q) is logically equivalent to which of the statements below?
I. p ⇒ q
II. q ⇒ p 
III. (¬q) ∨ p
IV. (¬p) ∨ q
Answer : Option D
Explaination / Solution:

By rule of contrapositive, 


Q6. The following functional dependencies hold true for the relational schema R{V,W,X,Y,Z}:
V → W 
VW → X 
Y → VX 
Y → Z
Which of the following is irreducible equivalent for this set of functional dependencies ?
Answer : Option A
Explaination / Solution:



Q7.  Consider a database that has the relation schemas EMP(EmpId, EmpName, DepId). And DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus.

Which of the above queries are safe? 
Answer : Option D
Explaination / Solution:

Query which generates infinite number of tuples is called unsafe query. In the given question all the given queries generate finite number of tuples.

Q8. In a database system, unique time stamps are assigned to each transaction using Lamport’s logical clock . Let TS(T1) and TS(T2) be the timestamps of transactions T1 and T2 respectively. Besides, T1 holds a lock on the resource R, and T2 has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
if TS(T2) < TS(T1) then
Tis killed
else Twaits.
Assume any transactions that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks? 
Answer : Option A
Explaination / Solution:

Elder kills younger and youngers waits on elder. So both are not waiting for each other. Hence no deadlock and there won’t be any starvation as well because the transaction who got killed will be starting with same time stamp. 

Q9. A relational schema for a train reservation database is given below 
Passenger (pid, pname, age) 
Reservation (pid, cass, tid)

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)
Answer : Option D
Explaination / Solution:
No Explaination.


Q10. Suppose the predicate F(x, y, t) is used to represent the statement that person x can fool person y at time t. which one of the statements below expresses best the meaning of the formula ∀x ∃y ∃t (¬F (x, y, t))?
Answer : Option D
Explaination / Solution:
No Explaination.