CSI2132 Sample Final PDF
CSI2132 Sample Final PDF
The exam contains 3 different parts (Part I, Part II and Part III). In each part you have 4
questions available. You must select and provide the answers to exactly 2 questions in
each part. If you provide answers for more than two questions in any part of the exam
only the first 2 questions answered will be considered. The total number of questions to be
answered is 6, with 2 mandatory questions in each part.
Part I
3. (10%) Consider a relation with schema R (A, B, C, D) and the set F of functional
dependencies:
F= { AB→C , C→D , D→A }
The National Insurance Number (NIN) is unique for each employee. Knowing the NIN
and the contractNo the company is able to determine the hoursPerWeek that the
employee is doing. The NIN also allows the company to know the employee name
(eName). Using the hotelNo one can know the hotelLocation. Each contractNo is
associated with a particular hotel, which means that by knowing the contractNo the
company also knows the hotelNo.
a. (3%) Based on the information above, identify the four functional dependencies
described.
b. (3%) List all candidate keys.
c. (4%) Normalize the relation to the third Normal Form and show the resulting
relations.
Part II
i) (2%) “Find all the committees that integrate both professor ‘Piper’ and
professor ‘John’.”
ii) (3%) “Find the names of all professors who have not offices in any of those
buildings that Professor Piper has offices in.”
7. (10%) Consider again the relations that keep track of airline flight information from que
previous question:
Flights(flno: integer, origin: string, destination: string, distance, integer, departs:
timestamp, arrives: timestamp, price: integer)
Aircraft(aid: integer, aname: string, cruisingrange: integer)
Certified(eid: integer, aid: integer)
Employees(eid: integer, ename: string, salary: integer)
a. (2%) Write a SQL query to list in reverse alphabetical order all pilots who are
certified to fly some Airbus plane.
b. (2%) Write a SQL view multi that displays all pilots and the number of airplanes
that they can fly.
c. (3%) Using the SQL view multi above write a query for finding the name(s) and
salary(salaries) of the pilot(s) who is(are) certified to fly the largest number of
planes.
d. (3%) Write a SQL query that, for each plane that has at least six pilots, shows
the name of the plane and the average salary of the pilots who are certified to fly
it.
Part III
B - I can use a RAID level 1 technique 2 - I’m not concerned with losing data. My main
because goal is to be able to read and write at high
speed.
C - I can use a RAID level 5 technique 3 - I have 6 disks available but I need the
because capacity of 5 of them which means that I can
only spare the space corresponding to a single
disk to ensure redundancy.
D - I can use a RAID level 6 technique 4 - I only have two disks available which
because represent more than the double of the capacity
that I need for my application and I’m
concerned with being able to recover data if
necessary.
a. (5%) Show the B+-tree that results after inserting (in the given order) 56, 50, 75,
87, 48.
b. (5%) Using the B+-tree previously obtained in (a.) show the B+-tree that results
after delete (in the given order) 50, 24, 65, 93, 75.
a. (4%) Construct a bitmap index for the attributes Brand and Color for this table.
b. Show how bitmap indices can be used to answer the queries:
i. (3%) “Show the Brand of all cars that are not black”
ii. (3%) “Give the total number of red Opel cars with a medium risk score.”
12. (10%) Consider the following hash function h(x)=x mod 4 for building an hash index.
This function allows you to use 4 different buckets. Assume that each bucket can only
contain 3 index entries.
a. (5%) Use this function to build the hash index of the following search key values:
2, 4, 6, 12, 13, 16, 20, 24, 28, 40
b. (5%) Given the search key values, is this function a good hash function? Explain
your answer.