Assignment1__1_.pdf
Assignment1__1_.pdf
Assignment: 1
Due Date: 8th August, 2017
Instructions
This question paper contains 15 questions in 5 pages.
Q1: The users are allowed to access different parts of data differently. They have editing rights for some data and only
viewing rights for some and no right for other data. This is an example of feature in DBMS.
A. data integrity
B. data security
C. data isolation
D. atomic operations
Explanation: Data security property in DBMS gives the power to provide different levels of access controls
to different people.
1
Fundamentals of Database Systems Assignment: 1
Explanation: ((r × s) ÷ r) = s
Q4: Consider the following relation, where the primary key is underlined.
Explanation: The table Flights needs to be joined with itself but needs to be renamed for the distinction
for specifying join condition and while projecting, the ideal join conditions for feasible flights require the
destination of 1st flight and source of 2nd flight to be same and the departure time of 2nd flight to be after the
arrival of first.
Explanation: A and B are true from definition. For C, Candidate key itself is a subset of a candidate key,
thus can be a superkey. D is false follows from definition.
Q7: In a bank, each customer is given a unique identification number, cid. All the current account holders have dif-
ferent (Firstname, Lastname) pair. (Some of them may have same first names, or same lastnames.)
As per the RBI regulations, the bank also collects everyone’s Adhaar Card number. The company’s database
stores the following fields: (cid, firstname, lastname, age, adhaar)
Page 2 of 5
Fundamentals of Database Systems Assignment: 1
A. Row 1 and 2
B. Row 2 and 3
C. Only Row 3
D. Only Row 4
Explanation: Only (cid) and (adhaar) are candidate keys. Any superset of those are superkeys and any ONE
of those can be chosen as primary key.
Q8: If a database has two tables T 1 , T 2 and both of these tables have a same column C, then C is a foreign key.
A. True
B. False
Explanation: Just having a same column does not make it a foreign key. It needs to be a primary key for one
table, and then it is called a foreign key for the other table.
Q9: An operation on the relation A outputs B such that B contains only selected attributes of A. Operation would be
called:
A. Selection
B. Difference
C. Projection
D. Intersection
Q10: Following sequence of operators are used on a schema. In which of the following, would the database schema
be unchanged?
A. Select, Union, Select, Difference
B. Select, Project, Union, Select
C. Select, Difference, Cartesian Product, Union
D. Project, Difference, Union, Select, Rename, Select
Page 3 of 5
Fundamentals of Database Systems Assignment: 1
Explanation: Project, Cartesian Product and Rename operators change the schema, others don’t.
Explanation: These operators do not add any expressive power, only make it easier to write complex queries.
Q12: Given relations r and s. Function C denotes number of results in the output. Which of the following statements
can be correct?
I C(r Z s) > C(r AY s)
II C(r AY s) > C(r A[@ s)
III C(r A[@ s) > C(r X@ s)
IV C(r AY s) > C(r X@ s)
A. I and II
B. II and III
C. Only III
D. III and IV
Explanation: Left and right outer joins can yield result set of sizes both greater or smaller than each other
depending on the data. Full outerjoin will always have a set size greater than (or equal to) the result of left or
right joins.
Q13: Consider the following schema for an office payroll system, where primary keys are underlined and foreign keys
are italicized.
Write a query to display full name and designation of employees who have salary greater than average salary
given for their designation.
A. Π f name, desig σ salary>avg(salary) (Person ∗ (desig Gavg(salary) (Employee)))
B. Π f name, lname, desi g σ salary>av g(salary) (Person ∗ (Employee ∗ ( desi g G av g(salary) (Employee))))
C. Π f name, desig σ salary>avg(salary), pid, lname (Person ∗ (Employee ∗ (desig Gavg(salary) (Employee))))
Page 4 of 5
Fundamentals of Database Systems Assignment: 1
Explanation: Options A and D have wrong joins as they lack Employee table. Option C lacks full name.
Option B joins Employee table with the groups of average salary on designation, joins it with Person table
to fetch full name, selects rows with salary greater than average salary and projects appropriate attributes.
Q14: For the above payroll system, now assume that the Employee table has the following schema.
cur sal and init sal respectively represent current salary and initial salary of an employee. Write a relational
algebra query to calculate average rise in salary for each designation.
A. σdesig, avg(curr sal−init sal) (Employee)
Explanation: Aggregate operation avg() is required to be applied on generalised projection and on tuples
grouped by designation. Hence, options A and C are wrong, Option B is wrong because σ is neither applied
correctly nor required.
Q15: Consider the following relation schema and a query that uses additional operators of relational algebra.
r(A, B, C); s(D, A, E); t(A, B, C, D, E); u(C, D, E)
((r ∗ s) ∩ t) ÷ u
What can be said about the result set if we write this query using only the 6 basic operators of relational algebra.
Select all correct options.
A. Result set of the basic-operator-query will be larger than result set of given query.
B. Result set will have attributes A and B only.
C. Some of the operations in query cannot be performed due to incompatible relation schemas.
D. Query cannot be written using only basic operators.
Explanation: Additional operators do not add any power over basic relational algebra, thus the query can
be written using basic operators, however the result set will be exactly the same since it would be the exact
same query. It is evident from definition of the involved operators that all relevant schemas are compatible.
Schema of natural join will be (A, B, C, D, E) since the join will happen on A, and division with (C, D, E)
will result in schema (A, B).
Page 5 of 5