CSCE 4523 Introduction to Database Management Systems Final Exam Fall 2016 I have neither given, nor received,unauthorized assistance on this exam. Signature Printed Name: Attempt all of the following questions. The test consists of 29 multiple choice/fill in the blank/short answer questions. For multiple choice questions, indicate which you consider the single most appropriate answer. Indicate your selection circling your selection. For fill in the blank questions, provide the missing word or fill in the letter for the most appropriate option, when options are given. The exam questions total 61 points and the exam will be graded out of 60, so there is 1 bonus point built in. If you have any questions about the questions, write your assumptions in the margin and answer the question as you understand it. You may bring in any database textbook and 1 page of paper with anything written on it, front and back. If you do not bring in a textbook, you may instead bring in 3 pages of paper with anything written on them, front and back. 1
1. In relational algebra, R a. R X S b. R X (condition) S c. σ (condition) R X σ (condition) S d. σ (condition) (R X S) e. None of the above (condition) S can be rewritten as: 2. (4 points) Fill in the blanks. Use each letter exactly once: THETA JOIN EQUIJOIN NATURAL JOIN OUTER JOIN a. The most general type of join. b. Displays tuples in result with no matching values in other table. c. Joins attributes with the same values d. Joins attributes with the same name and same values. 3. (4 points) Consider a database that includes two relations Student and Program S P Matric_No F_Name L_Name Prog_Code 04009991 Alicia Smith 0001 04009992 Alan Smith 0002 04009995 Alicia Bush 0001 04009995 John Smith 0001 Prog_Code P_Name 0001 Computing 0002 Soft. Eng. Fill in the SQL expression that would return the following result: F_Name L_Name Program Alicia Smith Computing John Smith Computing 2
SELECT F_Name, L_Name, AS FROM S, P WHERE S.Prog_Code = AND S.Prog_Code = AND = Smith ; 4. (3 points) Given a database: Customer(Cust_no, Name, Address) Order(Order_no, Cust_no, C_Date, Completed) Make(Order_no, Maker_no, Dress_style, Colour) Fill in the blanks for the SQL command which will most likely return the date and maker number of all orders that are not yet completed that have been ordered by Customer number 1234. SELECT, Maker_no FROM Customer, Order, Make WHERE 1234 AND = no ; 5. Assume you have a sorted file that we want to be able to do binary search on. Each record has the following fields: Name (max 30 chars), SSN (9 chars), Address (max 40 chars). Assume that the file is stored on Linux, we use 1 byte per character, and we separate the fields with blanks and the records with newlines. How big is each record? a) 80 bytes b) 81bytes c) 82 bytes d) 83 bytes e) The record sizes will vary based on the string lengths. 6. In JDBC and ODBC, there is a class named Statement. Which the following methods in Statement should be used to run SQL INSERT and DELETE commands? a) execute b) executeupdate c) update d) executequery e) query 3
7. In JDBC and ODBC, there is a class named Statement. Which the following methods in Statement should be used to run SQL SELECT commands? a) executeupdate b) execute c) update d) executequery e) query 8. (6 points) Fill in the blanks below based on the diagram above. Use each letter exactly once: Registers a. Primary key. datejoined Manages Lease Supervises b. Recursive relationship type c. Binary relationship type. d. Relationship attribute. e. Entity type. branchno in Branch f. Ternary relationship type. 4
9. When modeling binary relationships in an ER diagram, which cardinality ratios are possible? a) 1:1 b) 1 : N c) M : N d) all of above e) none of the above 10. (3 points) Consider a relation R(A, B, C, D, E). in which A, B is the primary key. R has the following functional dependencies: A, B C, D, E A C R is in at least 1 st normal form because a) There are no partial dependencies b) There are no multivalued attributes c) There are dependencies on a non-candidate key attribute d) There are no transitive dependencies e) It is not in 1NF. R is not in 2 nd normal form because a) There are partial dependencies b) There are multivalued attributes c) There are dependencies on a non-candidate key attribute d) There are transitive dependencies e) It is already in 2NF. After transforming R into 2 nd normal form, the resulting relations would be: a) It is in 2 nd normal form. b) R1 (A, B, C, D) & R2 (A, E) c) R1 (A, C, E) & R2 (B, D) d) R1 (A, B, D, E) & R2 (A, C) e) None of the above. 11. If a table has been normalized so that the determinants of all functional dependencies are candidate keys, then the highest normal form that the table is in is: a) UNF b) 1NF c) 2NF d) 3NF e) BCNF 5
12. (3 points) Consider the relation Student(StudentId, Name, Birthyear, Age, Major, Dept) in which StudentId is the primary key. Student has the following functional dependencies: StudentId Name, Birthyear, Major Major Dept Birthyear Age Student is in at least 2 nd normal form because a) There are no transitive dpendencies b) There are no partial dependencies c) There are no multivalued attributes d) b and c e) It is not in 2NF. Student is not in 3 rd normal form because a) There are transitive dependencies b) There are partial dependencies c) There are multivalued attributes d) There are dependencies on a non-candidate key attribute e) It is already in 3NF. After transforming Student into 3 rd normal form, the resulting relations would be: a) Student(StudentId, Name, Birthyear, Age, Major, Dept) & Demographics(Birthyear, Age) & Academics(Major, Dept) b) Student(StudentId, Name, Birthyear, Major, Dept) & Demographics(Birthyear, Age) c) Student(StudentId, Name, Birthyear, Major) & Demographics(Birthyear, Age) & Academics(Major, Dept) d) Student(StudentId, Name, Birthyear, Age, Major, Dept) & Demographics(Birthyear, Age) e) It is in 3 rd normal form f) None of the above 13. The difference between 3NF and BCNF is that 3NF allows the following (that BCNF does not) a) Transitive dependencies b) Dependencies on non-candidate keys c) Multivalued dependencies d) Partial dependencies e) There is no difference. 6
14 The difference between BCNF and 4NF is that BCNF allows the following (that 4NF does not) a) Transitive dependencies b) Dependencies on non-candidate keys c) Multivalued dependencies d) Partial dependencies e) There is no difference. 15. Which is a disadvantage of the Web-DBMS approach? a) Security b) Standardization c) Easier GUI development d) Simplicity e) Scalable deployment 16. Which an advantage of the Web-DBMS approach? a) Reliability b) Performance decrease c) Decreased bandwidth d) Statelessness e) Platform independence 17. The database system must take special actions to ensure that transactions operate properly without interference from concurrently executing database statements. This property is referred to as a) Atomicity b) Consistency c) Isolation d) Durability e) All of the above 18. Which of the following is all-or-none property for transaction processing? a) Atomicity b) Consistency c) Isolation d) Durability e) All of the above 19. When a transaction reads the value of from the database that based on an uncommitted transaction, it is called a: a) Lost Update b) Dirty Read c) Inconsistent Analysis d) Non-serializable e) None of the above 7
20. In two phase locking, transaction obtains lock and release it in (respective order): a) Shrinking phase & Initial Phase b) Running phase & Completion Phase c) Growing phase & Shrinking phase d) Initial phase & Completion Phase e) None of the above 21. Consider following transactions Which of the following schedules below is the correct serialization (i.e., an equivalent non-serial schedule) of the above? a) T1 - >> T2 ->> T3 b) T2 ->> T3 ->> T1 c) T1 ->> T3 ->> T2 d) T3 ->> T2 ->> T1 e) This is a non-serializable schedule. 22. Rather than avoiding conflicts using locking or timestamping, some systems use optimistic scheduling techniques because: a) They are just naturally optimistic database designers b) Invalid data in the database is unimportant c) Rollbacks are inexpensive d) Conflicts are rare e) None of the above 23. Which is NOT true of Deferred Updates: a) Updates are not written to the database until after a transaction has reached its commit point. b) If transaction fails before commit, it will not have modified database and so no undoing of changes required. c) May be necessary to redo updates of committed transactions as their effect may not have reached database. d) They are all true. 8
24. Which is not a property of B+ trees: a) The tree is balanced. b) Internal nodes can store at most M-1 keys and M pointers. c) Internal nodes are at least half full. d) The internal nodes store all the keys and all the associated records. e) The leaf nodes store the records in random order. 25. (2 points) Draw the following B+ tree after the insertion of 13: 26. (2 points) Draw the following B+ tree after the deletion of 16: 9
27. The most efficient ordering of relational algebra operations in a relational algebra tree, from bottom to top, is: a) Joins at the bottom, then projects, then selects. b) Selects at the bottom, then projects, then joins. c) Projects at the bottom, then selects, then joins. d) Cartesian products at the bottom and one big select at the top. e) Order doesn t matter. 28. When implementing JOIN on relations R and S, which is not true about the processing time: a) Is at least R+S. b) Is at most R*S c) Varies depending on what index structures, if any are used. d) Is measured in terms of comparison operations in memory. e) The above are all true. 29. (14 points) For each of the questions below, circle either or False False In 5NF, we decompose all relations into as many relations as possible without introducing errors. False In 5NF, all tables consist of just the primary key and one attribute. False CGI stands for Complex Graphical Interface. False HTTP is a stateless protocol. False PHP scripts run on the client machine. False The consistency property ensures that any transaction will bring the database from one valid state to another. False The durability property ensures that once a transaction has been committed, its effects are permanent. False Starvation is a problem encountered in concurrent computing wherein two processes are blocked forever, awaiting each others resources. False If the Precedence Graph for a schedule contains a cycle, then the schedule is serializable. False In Strict Two-Phase Locking, all locks are removed as soon as possible. False Dynamic query optimization adds a overhead to every query execution. False If the Relation Connection Graph has cycles, that means that the query is incorrectly formulated. False Many different relational algebra trees (RATs) can be constructed for a single SQL query. False Query optimizers estimate the cost for all possible execution trees and then pick the least expensive. 10