






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: Relational Algebra, Describing, Buildings, Employees Work, Queries, Employees Work, Paid Employee, Computing, Join Algorithms, Ignore Output
Typology: Exams
1 / 12
This page cannot be seen from the preview
Don't miss anything!
Department of EECS, Computer Science Division CS186 Final Exam May 16, 2000
This exam has seven sections, each with one or more problems. Each problem may be 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 some of the questions.
There are six tables describing a company, describing employees, departments, buildings, which department(s) an employee works in (and a percentage of the time for each), department managers (possibly more than one per department), and in which building an employee works (an employee may have more than one office). The primary key of each table is the attribute(s) in capitals. Other attributes are not necessarily unique.
EMP – 100,000 tuples, 1,000 pages EID EName Salary Start_Date End_Date 001 Jane $124,000 3/1/93 null 002 Jim $32,000 2/29/96 null 003 John $99,000 12/12/98 null 004 Joe $55,000 2/2/92 null 005 Jenny $51,000 5/5/95 null EID values range from 1 to 100,
BUILDING – 2,000 tuples, 10 pages BID BName Address 201 ATC 1600 Ampitheatre 202 CCC 500 Crittenden 203 MFB 123 Shoreline BID values range from 1 to 2,
DEPT – 1,000 tuples, 5 pages DID DName Annual_Budget 101 Research $1,001, 102 Development $500, 103 Sales $2,000, DID values range from 1 to 1000
IN_DEPT – 110,000 tuples, 550 pages EID DID Percent_Time 001 101 100 002 102 100 003 101 60 003 102 40 004 103 100 005 103 100
IN_BUILDING – 110.000 tuples, 550 pages EID BID 001 201 002 201 003 202 003 203 004 202 005 203
MANAGES_DEPT – 800 tuples, 4 pages EID DID 003 101 003 102 001 103
You must write your answers on these stapled pages. You also must write your name at the top of every page except this one , and you must turn in all the pages of the exam. You may remove this page from the stapled exam, to serve as a reference, but do not remove any other pages from the stapled exam! Two pages of extra answer space have been provided at the back in case you run out of space while answering. If you run out of space, be sure to make a “forward reference” to the page number where your answer continues.
CS186 March 6 Midterm Page 2
a. SELECT Bname FROM IN_BUILDING GROUP_BY BID WHERE Count(*) > 50
b. SELECT Bname FROM BUILDING WHERE BID IN (SELECT BID FROM In_Building GROUP BY BID HAVING Count(*) > 50)
c. SELECT Bname FROM Building B, In_Building I WHERE B.BID = I.BID GROUP BY B.BID HAVING Count(*) > 50
d. SELECT Bname FROM Building B WHERE 50 < (SELECT Count(*) FROM In_Building I WHERE I.BID = B.BID)
e. None of the above
a. SELECT Dname FROM Dept WHERE DID IN (SELECT I.DID FROM In_Dept I GROUP BY I.DID HAVING COUNT(*) = 0)
b. SELECT Dname FROM Dept D, In_Dept I, Emp E WHERE I.EID = E.EID and D.DID = I.DID and Count(E.EID) = 0
c. SELECT Dname FROM Dept WHERE DID NOT IN (SELECT DISTINCT DID FROM In_Dept I)
d. SELECT Dname FROM Dept D Where Not Exists (SELECT * FROM In_Dept I, EMP WHERE I.EID = EMP.EID and I.DID = D.DID)
e. None of the above
CS186 March 6 Midterm Page 4
a) What is the I/O cost of this operation? _________
b) What is the reduction factor? ________
2. Consider the join: In_Dept ×××× Dept (4 points)
a) What is the I/O cost of this using Blocked Nested Loops? __________
b) What is the I/O cost of this using Index Nested Loops, with a Hash index on Dept.DID?
3. Consider the join: Dept ×××× In_Dept (4 points)
a) What is the I/O cost of this using Blocked Nested Loops? ____________
b) What is the I/O cost of this using Index Nested Loops, with a Hash index on In_Dept.DID?
__________________________
CS186 March 6 Midterm Page 5
CS186 March 6 Midterm Page 7
Locking is the most popular concurrency control technique implemented by commercial database management systems.
a. No locking is necessary. b. Only read locks are necessary and they need to be held until end of transaction. c. Only read locks are necessary but they can be released as soon as the read is complete. d. Both read and write locks are necessary and locking must be done in two phases. e. None of the above.
Consider the following database schema:
STUDENT(name, sid, gpa, level, dept)
Suppose the following two transactions are executed concurrently:
T1: begin tran update STUDENT set gpa = 4.0 where dept = 'CS' commit tran
T2: begin tran insert into STUDENT values ('Mihut', 101, 3.9, 4, 'CS') insert into STUDENT values ('Sirish', 102, 3.9, 3, 'CS') commit tran
CS186 March 6 Midterm Page 8
Write-ahead logging is the most popular recovery technique.
a. After a soft crash (which does not affect data on hard drives), the log only needs to be scanned back until the last checkpoint is found. The log beyond the last checkpoint will not be read during the recovery process. b. Once a checkpoint is done, the log can be truncated. c. Checkpoint is automatically performed after every transaction commit. d. Checkpoints should be done after every update to the database. e. None of the above.
a. Updated pages must be written to disk immediately after the update. b. Dirty pages must be written to disk at transaction commit time but before the transaction log is written to disk. c. Dirty pages must be written to disk at transaction commit time but after the transaction log is written to disk. d. A dirty page must be written to disk when it is replaced from the buffer pool. e. None of the above.
CS186 March 6 Midterm Page 10
ii. Integrity Constraints
iii. Blobs
iv. Indexes
E-vite uses the log for an interesting purpose not discussed in the book. In 15 words or less, what unusual thing do they do with the log?
Score: Section I ____________/
Section II ____________/
Section III ____________/
Section IV ____________/
Section V ____________/
Section VI ____________/
Section VII ____________/
Section VIII ____________/8 (extra credit)
Total ____________/100 (108 With extra credit)
CS186 March 6 Midterm Page 11
Additional Space