CS411 Database Systems Final Exam, UIUC, Dec 2006, Exams of Deductive Database Systems

The final examination for the cs411 database systems course offered by the department of computer science at the university of illinois at urbana-champaign in december 2006. The exam consists of multiple-choice and problem-solving questions covering various topics related to database systems, including triggers, indexing, hash tables, transaction logs, and query optimization.

Typology: Exams

Pre 2010

Uploaded on 03/16/2009

koofers-user-j71
koofers-user-j71 🇺🇸

9 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
NetID:
CS411 Database Systems
Fall 2006
Department of Computer Science
University of Illinois at Urbana-Champaign
Final Examination
December 15, 2006
Time Limit: 180 minutes
Print your name and NetID below. In addition, print your NetID in the upper right
corner of every page.
Name: NetID:
Including this cover page, this exam booklet contains 13 pages. Check if you have
missing pages.
The exam is closed book and closed notes. No calculators or other electronic devices
are permitted. Any form of cheating on the examination will result in a zero grade.
Please write your solutions in the spaces provided on the exam. You may use the blank
areas and backs of the exam pages for scratch work. Please do not use any additional
scratch paper.
Please make your answers clear and succinct; you will lose credit for verbose, convo-
luted, or confusing answers. Simplicity does count!
Problem 1 2 3 4 5 6 7 8 Total
Points 10 10 11 16 12 10 16 15 100
Score
Grader
Turn over the page when instructed to do so.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download CS411 Database Systems Final Exam, UIUC, Dec 2006 and more Exams Deductive Database Systems in PDF only on Docsity!

CS411 Database Systems

Fall 2006

Department of Computer Science

University of Illinois at Urbana-Champaign

Final Examination

December 15, 2006

Time Limit: 180 minutes

  • Print your name and NetID below. In addition, print your NetID in the upper right

corner of every page.

Name: NetID:

  • Including this cover page, this exam booklet contains 13 pages. Check if you have

missing pages.

  • The exam is closed book and closed notes. No calculators or other electronic devices

are permitted. Any form of cheating on the examination will result in a zero grade.

  • Please write your solutions in the spaces provided on the exam. You may use the blank

areas and backs of the exam pages for scratch work. Please do not use any additional

scratch paper.

  • Please make your answers clear and succinct; you will lose credit for verbose, convo-

luted, or confusing answers. Simplicity does count!

Problem 1 2 3 4 5 6 7 8 Total

Points 10 10 11 16 12 10 16 15 100

Score

Grader

Turn over the page when instructed to do so.

Problem 1 (10 points) True/False Questions

For each of the following statements, indicate whether it is TRUE or FALSE by circling your choice. If you change your mind, cross out both responses and write “True” or “False”. You will get 1 point for each correct answer, 0 points for each incorrect answer.

(1) T rue F alse Triggers can operate on insertion, deletion, and updates.

(2) T rue F alse A user application executes a database Trigger by invoking “RUN TRIGGER triggername”

(3) T rue F alse Secondary storage is volatile.

(4) T rue F alse Seek time is part of the disk latency time.

(5) T rue F alse When an index is clustered it requires that the data records are sorted in the search key order of the index.

(6) T rue F alse B+ trees can include duplicate keys.

(7) T rue F alse B+ trees can be used to perform ranged queries.

(8) T rue F alse When a sparse index is used, each record must have an entry in the index.

(9) T rue F alse In fixed-length records, a character field of type CHAR is NOT allowed.

(10) T rue F alse Spanned records refer to records that are longer than blocks and therefore are broken into fragments.

Problem 3 (11 points) Data Storage

(1) How many blocks are on a disk with the following characteristics? Sector size of 512 bytes, 16 sectors per track, 16384 tracks per surface, 4 double sided platter, and 4096 bytes per block. [2 points]

(2) Explain (i) what it means for a block to be pinned and (ii) give one reason for pinning a block. [3 points]

(3) What is the purpose of a tombstone in an offset table [2 points]?

(4) How many records can we put into a block of size 4096 bytes with the following conditions? [4 points] a) Each record has the following fields in order: a real of 6 bytes, a character string of length 17 bytes, and an 8 byte timestamp. b) The record header consists of two 4 byte pointers and one 10 byte date. c) Fields must start at a byte location that is a multiple of 4. d) Block header includes eight additional 4-byte integers.

Problem 4 (16 points) Triggers

Consider the following tables with the following inserts and triggers:

CREATE TABLE UserBucket (firstname VARCHAR(20), lastname VARCHAR(20), bucket INT DEFAULT NULL);

CREATE TRIGGER UserBeforeTrigger BEFORE INSERT ON UserBucket FOR EACH ROW REFERENCING NEW ROW AS NewTuple WHEN (NewTuple.firstname LIKE ’E%’) SET NewTuple.bucket=1;

CREATE TABLE BucketCount (bucketid INT, count INT); INSERT INTO BucketCount(bucketid, count) VALUES(0, 0); INSERT INTO BucketCount(bucketid, count) VALUES(1, 0);

CREATE TRIGGER UserAfterTrigger AFTER INSERT ON UserBucket FOR EACH ROW REFERENCING NEW ROW AS NewTuple UPDATE BucketCount SET count=count+1 WHERE bucketid=NewTuple.bucket;

CREATE TRIGGER UserTableTrigger AFTER UPDATE OF lastname ON UserBucket REFERENCING OLD TABLE As OldStuff NEW TABLE AS NewStuff BEGIN UPDATE BucketCount SET count=(SELECT count(*) FROM OldStuff) END

(a) Show the contents of the UserBucket table after executing the following query: [3 points]

INSERT INTO UserBucket(firstname, lastname) VALUES(’Evan’, ’Smith’);

Problem 5 (12 points) B+ Tree Consider the B+ tree index of degree 3 shown in the figure below. For each problem below, you only need to show the final resulting B+ Tree.

5 13

(^1 247 )

Figure 1: Problem 5

a) Show the tree that would result from inserting a data entry with key 19 into this tree. [2 points]

b) Show the B+ tree that would result from inserting a data entry with key 3 into the original tree. [3 points]

c) Show the B+ tree that would result from deleting the data entry with key 10 from the original tree. [2 points]

d) Show the B+ tree that would result from deleting the data entry with key 14 from the original tree. [3 points]

e) Explain why in a real database most relations only require B+ trees with two or three levels. [ points]

Problem 7 (16 points) Transaction Logs

A database has four elements, A, B, C, and D. Assume that the following is a normal sequence of undo log records, using non-quiescent checkpointing:

1

2 <T1,B,40>

3

4 <T2,A,56>

5 <T2,C,34>

6

7

8 <T3,B,12>

9

10 <T3,D,89>

11

12 <T4,C,7>

13 <T3,A,22>

14

15 <T3,A,99>

16

(a) When is the latest time for transaction T1, T2 that ”dirty data” can be flushed onto disk (ie, the time Output(X) for data X can be performed)? [2 points]

For T1: Output(s) before Log Line. For T2: Output(s) before Log Line.

(b) Suppose we start checkpointing right after Log 5, indicate where and what the start check- pointing record would look like. Then, indicate where and what the earliest end checkpoint record would look like. [2 points]

Between Log Line 5 and 6, <START CKPT( , )> Between Log Line and ,

(c) Continue from (b). Suppose the system crashes right after Log 14 and the end checkpoint has been written out to disk. What is the contents of the earliest log line we must examine? And which transaction records do we need to undo in sequence? [4 points]

Earliest Log Line Contents: < >, Transaction Sequence:

(d) Now, suppose that the log is a redo log. When is the earliest time for transactions T3 and T4 that ”dirty data” can be flushed onto disk? [4 points] For T3: Output(s) after Log Line. For T4: Output(s) after Log Line.

(e) Show the contents of log line 13 if this was extended to be undo-redo log. Assume the values shown are the undo log entries. [2 points]

(f) Explain one advantage of using a redo log as opposed to an undo log. [2 points]

c) Grand Challenge: Design another plan that can further reduce the amount of data transferred between the two sites than plans A and B. Briefly describe your plan and calculate the total number of bytes transferred between sites X and Y for your plan. [Hint: Try to avoid transferring the whole relation.] [5 points]

END OF CS411 FINAL EXAM