



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Main points of this past exam are: Er Model, Reference Database, Salesperson, Rotational Speed, Maximum Rotational Delay, Data Page, Slot Directory, Algorithm, Clustered Index, Nonclustered Index
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!
Department of EECS, Computer Science Division CS186 Midterm I Oct 5, 1999
This exam has five problems. Each problem is made up of multiple questions. You should read through the exam quickly and plan your time-management accordingly. Before beginning to answer a question, be sure to read it carefully and to answer all parts of every question!
REFERENCE DATABASE. This is the Reference Database referred to in this exam.
There are four tables. SALESPERSON contains the names, ids, regions & quotas for the salespeople. Ids are unique, names are not, and there is only one salesperson per region. PRODUCTS contains the product names, product ids, and prices for the products. The product ids are unique.
SALESPERSON Sname Sid Region Quota
Frances 25 TX $
Bob 31 CA $
Frances 74 MA $ Mary 89 FL $
CUSTOMERS contains the customer names, customer ids, and regions for the customers (customer ids are unique), and ORDERS contains the customer id, the product id, and the product ordered per customer.
Cname Cid Region Bob 1 TX Harry 2 TX Lin 3 MA Martha 4 FL Lin 5 FL Leyla 6 CA
Cid Pid Quantity 1 152 1 2 152 1 4 831 1 4 131 1 5 255 1 6 831 1
Pname Pid Pprice disks 131 $ pcs 152 $ macs 831 $ printers 255 $ paper 221 $
Section You Usually Attend ______________________________Login_________________________
1. Relational Model and ER Model (20 points). a. (2 points) Using the Reference Database as an example, give an example of data independence contrasting the use of a file system to store the information in the SALESPERSON table with the use of a relational database to store the same information.
b. (2 points) What is the cardinality of the table SALESPERSON in the Reference Database on page 1? What is the degree of the table SALESPERSON?
c. (4 points). Name the primary keys of each of the four tables in the Reference Database on Page 1.
d. (4 points) For each table in the Reference Database on Page 1, determine whether or not it has a foreign key, and if so, list what it is and what it references.
e. (8 points) Modify the following ER diagram to represent the Reference Database on Page 1, including the salesperson entities and relationships.
Quantity
Region
Cname
Cid
Pprice
Pname
b. [5 points] In the Reference Database on Page 1, name one advantage of building a clustered index on the Sname field of the SALESPERSON table. Name one disadvantage. Under what circumstances would a nonclustered index on the Sname field be the best choice?
b. [5 points] In the PRODUCTS table in the reference database on page 1, assume that there are actually many more records in the PRODUCTS table than are listed in the table shown – assume that there are P pages with R records per page. Given an Extendible Hashing index on the Pid attribute, what is the number of I/Os required (worst case) to fetch all Pids between 131and 150, including 131 & 150? You should assume that bucket pages are internally organized like heap file pages. You may assume any alternative you wish for storing data entries in the index, and for buffering data in the system, but you must state the alternative and the buffering assumptions, and present the correct analysis for those assumptions.
c. [5 points] In the reference database on Page 1, assume that the CUSTOMERS records are much larger than shown in the table on the page – in fact, each record fits in exactly one page, so the CUSTOMERS table is 5 pages long.. Draw a B+ tree index on Cname, assuming that d = 2, using any of the alternatives discussed in text, but explain which alternative you are using.
d. [5 points] The DBA for the reference database on Page 1 has created a sparse index on the PRODUCTS table (again, assuming that the PRODUCTS table has many more records than are listed on Page 1). The sparse index is on Pname. Explain in terms of accesses to the table PRODUCTS the advantages of a sparse index on Pname. Explain the disadvantages.
4. Relational Algebra (16 points)
A. (10 points; 2 points each) Show the rows resulting from the following queries, using the reference database.