CIS 631 Database Management Systems Sample Final Exam



Similar documents
Physical Data Organization

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Physical Design. Phases of database design. Physical design: Inputs.

Chapter 8: Structures for Files. Truong Quynh Chi Spring- 2013

Unit Storage Structures 1. Storage Structures. Unit 4.3

COMPARISON OF FIXED & VARIABLE RATES (25 YEARS) CHARTERED BANK ADMINISTERED INTEREST RATES - PRIME BUSINESS*

COMPARISON OF FIXED & VARIABLE RATES (25 YEARS) CHARTERED BANK ADMINISTERED INTEREST RATES - PRIME BUSINESS*

Comp 5311 Database Management Systems. 16. Review 2 (Physical Level)

Chapter 13: Query Processing. Basic Steps in Query Processing

AT&T Global Network Client for Windows Product Support Matrix January 29, 2015


DATABASE MANAGEMENT SYSTEMS. Question Bank:

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Lecture 1: Data Storage & Index

Chapter 13 Disk Storage, Basic File Structures, and Hashing.

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) Total 92.

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25)

Chapter 13. Disk Storage, Basic File Structures, and Hashing

Physical Database Design Process. Physical Database Design Process. Major Inputs to Physical Database. Components of Physical Database Design

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 13-1

Chapter 13. Chapter Outline. Disk Storage, Basic File Structures, and Hashing

University of Massachusetts Amherst Department of Computer Science Prof. Yanlei Diao

Case 2:08-cv ABC-E Document 1-4 Filed 04/15/2008 Page 1 of 138. Exhibit 8

Big Data and Scripting. Part 4: Memory Hierarchies

DATABASE DESIGN - 1DL400

Database Systems. Session 8 Main Theme. Physical Database Design, Query Execution Concepts and Database Programming Techniques

LiTH, Tekniska högskolan vid Linköpings universitet 1(7) IDA, Institutionen för datavetenskap Juha Takkinen

Enhanced Vessel Traffic Management System Booking Slots Available and Vessels Booked per Day From 12-JAN-2016 To 30-JUN-2017

SQL Query Evaluation. Winter Lecture 23

IT2305 Database Systems I (Compulsory)

Database Design Patterns. Winter Lecture 24

Database Fundamentals: 1

Introduction to normalization. Introduction to normalization

Part A: Data Definition Language (DDL) Schema and Catalog CREAT TABLE. Referential Triggered Actions. CSC 742 Database Management Systems

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Using Multiple Operations. Implementing Table Operations Using Structured Query Language (SQL)

B+ Tree Properties B+ Tree Searching B+ Tree Insertion B+ Tree Deletion Static Hashing Extendable Hashing Questions in pass papers

Graham Kemp (telephone , room 6475 EDIT) The examiner will visit the exam room at 15:00 and 17:00.

Chapter 1 Overview of the SQL Procedure

Structured Query Language (SQL)

Databases and Information Systems 1 Part 3: Storage Structures and Indices

IT2304: Database Systems 1 (DBS 1)

Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design

B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees

Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C

CSCI315 Database Design and Implementation

Database Constraints and Design

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur

Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

Analysis One Code Desc. Transaction Amount. Fiscal Period

Instant SQL Programming

Questions 1 through 25 are worth 2 points each. Choose one best answer for each.

Analysis of Algorithms I: Binary Search Trees

DBMS / Business Intelligence, SQL Server

1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle

Data storage Tree indexes

Database Administration with MySQL

The process of database development. Logical model: relational DBMS. Relation

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA

Quiz! Database Indexes. Index. Quiz! Disc and main memory. Quiz! How costly is this operation (naive solution)?

Part 4: Database Language - SQL

In-Memory Databases MemSQL

Exercise 1: Relational Model

Files. Files. Files. Files. Files. File Organisation. What s it all about? What s in a file?

B2.2-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

Physical DB design and tuning: outline

TYPICAL QUESTIONS & ANSWERS

Outline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb

4. SQL. Contents. Example Database. CUSTOMERS(FName, LName, CAddress, Account) PRODUCTS(Prodname, Category) SUPPLIERS(SName, SAddress, Chain)

INTRODUCTION The collection of data that makes up a computerized database must be stored physically on some computer storage medium.

BCA. Database Management System

Chapter 8. SQL-99: SchemaDefinition, Constraints, and Queries and Views

External Sorting. Chapter 13. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

Databases What the Specification Says

Storage and File Structure

Efficiently Identifying Inclusion Dependencies in RDBMS

Multi-dimensional index structures Part I: motivation

SQL - QUICK GUIDE. Allows users to access data in relational database management systems.

Database Management Systems 2015

Question 1. Relational Data Model [17 marks] Question 2. SQL and Relational Algebra [31 marks]

Overview of Storage and Indexing

Chapter 5: Logical Database Design and the Relational Model Part 2: Normalization. Introduction to Normalization. Normal Forms.

Performance Evaluation of Natural and Surrogate Key Database Architectures

Record Storage and Primary File Organization

DATABASE NORMALIZATION

SQL Nested & Complex Queries. CS 377: Database Systems

Data Modelling and E-R Diagrams

DATA STRUCTURES USING C

Physical Design. Meeting the needs of the users is the gold standard against which we measure our success in creating a database.

A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:

Database Security. Soon M. Chung Department of Computer Science and Engineering Wright State University

External Sorting. Why Sort? 2-Way Sort: Requires 3 Buffers. Chapter 13

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

Relational Databases

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries

Storing Data: Disks and Files. Disks and Files. Why Not Store Everything in Main Memory? Chapter 7

Qi Liu Rutgers Business School ISACA New York 2013

Transcription:

CIS 631 Database Management Systems Sample Final Exam 1. (25 points) Match the items from the left column with those in the right and place the letters in the empty slots. k 1. Single-level index files a. Unary relationship x 2. Data Mining b. Unordered, ordered, and hashed z 3. Closure Set algorithm c. Domain, key, foreign key f 4. Internal Schema d. Not absolutely essential in a model n 5. BCNF e. No independent primary key i 6. Super key f. The structure of the stored data and related retrieval schema e 7. Weak entity type g. Successive read/write of the same data from two different transactions a 8. Recursive relationship h. Interleaved schedule equivalent of a serial o 9. Derived attribute i. Non-minimal primary key w 10. Primary key j. Systematic examination of the functional dependencies to establish the CK for the relation s 11. Intersection relation k. Primary, Clustering, and Secondary t 12. One-to-many relationship l. Same data to be modified in several places q 13. Minimum cardinality of one m. The new tuple cannot be inserted in a relation based on the current relation schema v 14. B-trees and B+ trees n. Every determinant is a candidate key r 15. ORDBMS o. Foreign key in either participating relation b 16. Primary file organizations p. Non-PK attribute is the determinant of a Non-PK attribute c 17. DB s necessary integrity constraints q. Mandatory (full) participation a 18. One-to-one relationship r. Allows handling of more complex data y 19. Many-to-many relationship s. Relation that contains tuples common in both relations m 20. Insertion anomaly t. PK of the parent entity placed in the child entity as FK z 21. 3NF compliance u. Relation (s) consistent with the 2NF requirements l 22. Update anomaly v. Dynamic structures that allow an index to expand and shrink h 23. Serializeable schedule w. Cannot be NULL g 24. Conflict in schedule x. Discovery of patterns and trends in the data u 25. DB free of partial dependency y. Two foreign keys in a relationship table e 26. Transitive dependency z. Eliminate partial and transitive dependencies 1

2. (15 points) Insert the following key values: 59, 23, 16, 28, 10, 1, 70, 79, 12, 19, 29, 72, 53, 45, and 90 into an initially empty B+-Tree in the given order. Suppose the orders of the B+-Tree are p = 4 and p leaf = 3. insert 59 59 59 o 59 insert 23 23 o 59 o 59 insert 16 16 o 23 o 59 o 28 59 insert 28 16 o 23 o 28 o 59 o 2

3. (10 points) Given the following schedule: S1: r 2 (X); r 1 (Y); w 2 (X); r 3 (X); w 1 (Y); w 3 (X); r 2 (Y); w 2 (Y); a. Is S1 serializable? If yes, what is the serialized schedule like? Demonstrate your work with a precedence graph. This is not serializable because of the following cycle. 1 2 3 b. (10 points) Given the following schedule: S2: r 2 (X); r 1 (Y); w 2 (X); r 2 (Y); r 3 (X); w 1 (Y); w 3 (X); w 2 (Y); Is S2 serializable? If yes, what is serialized schedule like? Demonstrate your work with a precedence graph. This is not serializable because of the following cycle. 1 2 3 3

(Next 10 points are worth 2 points each) 4. Which of the following statements is false? a. The data on secondary storage persists through power loss. b. The primary memory is not large or reliable enough to store the quantity of data a typical database might require. c. The data stored in primary storage is not lost when power is lost. d. Access time for primary storage is much faster than the secondary storage. 5. Which of the following does not correspond to a file organization? a. Hash b. Heap c. ISAM d. Sorted 6. Which of the following is false about heap files? a. A heap file has no particular ordering with respect to a field value. b. A linear search must be performed to access a record in a heap file. c. Heap files are best for bulk loading data into a table. d. When a record is deleted, the space is reused when inserting the next record. 7. Which of the following statements is true about a sorted file? a. Inserting and deleting records in a sorted file is easy. b. Ordered files are rarely used for DB storage unless a primary index is added to the file. c. When a record is inserted in a sorted file, it is placed at the end of the file. d. In general a linear search is more efficient than a binary search. 8. Which of the following statements is false about hash files? a. A hash function calculates the address of the page on which the record is to be stored. b. Each address generated by a hashing function corresponds to a page(bucket) c. A hash function is chosen so that records are not evenly distributed in the table. d. Several records can be placed in a bucket in order of arrival. 9. Which of the following statements is false? a. The values in the index file are ordered according to the indexing field. b. Primary index corresponds to a sequentially ordered data file and indexing field a key field of the file. c. Clustering index corresponds to a sequentially ordered data file and indexing field not a key field of the file. d. Secondary index corresponds to an index that is defined on an ordering field of the data file. 4

10. Which of the following is not a B+-Tree rule? a. If the root is not a leaf node, it must have at least two children. b. The # of key values contained in a non-leaf nodes is 1 less than the number of pointers. c. Different paths from root to leaves must have different lengths. d. Leaf nodes are linked in order of key values. 11. Which of the following is true? a. seek time + rotational latency = transfer time + access time b. seek time + rotational latency + transfer time = access time c. seek time + rotational latency + access time = transfer time d. seek time = rotational latency + transfer time + access time 12. Match the following: a. Seek time b a. Time to move to the desires block b. rotational time a b. Time to move to the desired track c. Transfer time d c. Time to move to the block, track, and exchange d. Access time c d. Time to read or write the data in the block 13. Match the following: a. RAID level 0 b a. Uses block-level data striping across all disks b. RAID level 1 c b. Lowest reliability and possibility of data loss c. RAID level 3 d c. Improved read and slightly lower write performance d. RAID level 5 a d. Improved read but poor write performance 5

11. (20 points) Given the Employee table, answer the following questions: EmpID Dept Salary HireDate SupervisorID 1001 Finance 10000 01-Nov-98 1020 1002 Finance 15000 12-Dec-96 1020 1020 Finance 30000 09-Feb-93 1035 1015 Human Resources 20000 15-Mar-01 1045 1008 Operations 9000 22-Aug-97 1013 1010 Operations 12000 09-Jul-01 1013 1035 Operations 40000 14-Sep-95 1000 1007 Maintenance 5000 07-Oct-01 1017 1050 Human Resources 10000 05-Apr-98 1045 1000 Executive 60000 25-Nov-93 1016 Human Resources 11000 13-Oct-01 1045 Q1. Which employee ID would be returned in the output given the following query on the Employee table? SELECT empid, dept, salary FROM employee outer WHERE salary > (SELECT min(salary) FROM employee inner WHERE inner.dept = outer.dept); a. 1020, 1015, 1035, 1007, 1000 b. 1020, 1015, 1035 c. 1000 d. 1001, 1050, 1008, 1007, 1000 e. 1002, 1020, 1015, 1010, 1035,1016 Q2. Which statements will delete all employees from the Finance department who make less than $20,000 and hired during the year 2001? a. DELETE FROM employee WHERE dept = Finance AND salary < 20000 AND hiredate BETWEEN 01-jan-01 AND 31-dec-01 ; b. DELETE FROM employee WHERE dept = Finance AND salary < 20000 AND hiredate >= 01-jan-01 AND hiredate <= 31-dec-01 ; c. DELETE FROM employee dept = Finance AND salary < 20000 AND hiredate >= 01-jan-01 AND hiredate <= 31-dec-01 ; d. DELETE FROM employee WHERE dept = Finance AND salary < 20000 hiredate >= 01-jan-01 AND hiredate <= 31-dec-01 ; 6

Q3. Which answer best describes the following query? SQL> SELECT empid, dept * WHERE salary IS NOT NULL and ROWNUM<5; a. Output will contain, empid and dept for any 5 employees who have salary data. b. Output will contain, empid and dept for any all employees who have salary data. c. Output will contain, empid and dept for any 5 employees who have no salary data. d. Output will contain, empid and dept for any 4 employees who have salary data. e. Output will contain, empid and dept for any 4 employees who have no salary data. Q4. Which answer best describes the following query? SQL> SELECT empid, dept 3* WHERE SupervisorID IS NULL and ROWNUM<2; a. Output will contain, empid and dept for any 2 who have no SupervisorID data. b. Output will contain, empid and dept for any employee who has no SupervisorID data. c. Output will contain, empid and dept for any employee whose SupervisorID data is zero. d. Output will contain, empid and dept for any 2 employees whose SupervisorID data is zero. e. Output will contain, empid and dept for any 2 employees whose SupervisorID data IS NULL. Q5. Which of the following statements will execute without errors? a. SQL> CREATE TABLE employee_bonus (EmpID varchar(10) NOT NULL, 2 ProjID varchar(10) NOT NULL, 3 Start_Date date, 4 End_Date date, 5 Rating number(5,1), 6 Bonus number(10)); b. SQL> CREATE TABLE employee_bonus (EmpID varchar(10) NOT NULL, 2 ProjID varchar(10) NOT NULL, 3 Start_date date NULL, 4 End_Date date NULL, 5 Rating number(5,1) NULL, 6* Bonus number(10,2) NULL); c. SQL> CREATE TABLE employee_bonus (EmpID varchar(10) NOT NULL, 2 ProjID varchar NOT NULL, 3 Start_date date, 4 End_Date date, 5 Rating number(5,1), 6* Bonus number(10,2) ); d. SQL> CREATE TABLE employee _bonus EmpID varchar(10) NOT NULL, 2 ProjID varchar(10) NOT NULL, 3 Start_date date, 4 End_Date date, 5 Rating number(5,1), 6* Bonus number(10,2) ); e. SQL> CREATE employee _bonus (EmpID varchar(10) NOT NULL, 2 ProjID varchar(10) NOT NULL, 3 Start_date date, 4 End_Date date, 5 Rating number(5,1), 6* Bonus number(10,2) ); 7

Q6. Which of the following queries will select the name and average salary for all departments that satisfy the following conditions: - include all departments EXCEPT Human Resources - average salaries greater than $10,000 - sort by department name - a. SQL> SELECT dept, avg(salary) 3 WHERE dept <> 'Human Resources' 4 GROUP BY dept 5* HAVING avg(salary)>10000; b SQL> SELECT dept, avg(salary) 3 GROUP BY dept 4 WHERE dept <> 'Human Resources' 5* HAVING avg(salary)>10000; c. SQL> SELECT dept, avg(salary) 3 WHERE dept <> 'Human Resources' 4 HAVING avg(salary)>10000 5* GROUP BY dept; d. SQL> SELECT dept, avg(salary) 3 WHERE dept NOT EQUAL TO 'Human Resources' 4 GROUP BY dept 5* HAVING avg(salary)>10000; Q7. Given the following SELECT statement, SQL> SELECT * FROM emp_hr; ID RATE ---------- ---------- 101 10 102 20 103 104 10 105 20 What is the output of the following query? SELECT AVG(Rate) FROM emp_hr; a. NULL b. 12 c. 15 d. 10 e. 20 8

Q8. Given the following SELECT statement, SQL> SELECT * FROM emp_hr; ID RATE ---------- ---------- 101 10 102 20 103 104 10 105 20 What is the output of the following query? SELECT AVG(NVL(Rate, 0))FROM emp_hr; a. NULL b. 12 c. 15 d. 10 e. 20 Q9. Which line of the following SELECT statement contains an error, if any? SQL> SELECT EmpID, fname, lname, HireDate 3 WHERE lname = Jones, date_of_hire> 06-jan-02 4 ORDER BY empid; a. 1 b. 2 c. 3 d. 4 e. No error Q10. Which of the following is not an aggregate function? a. COUNT b. AVG c. TOTAL d. SUM e. MIN f. MAX Q11. What is the outcome of the following query? SQL> SELECT EmpID, dept, salary 3* WHERE salary= ANY(30000,40000,50000) Your Answer: EmpID Dept salary 1020 Finance 30000 1035 Operations 40000 9