Examination paper for TDT4145 Data Modelling and Database Systems

Similar documents
Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION

L Information Systems for Engineers. Final exam. ETH Zurich, Autumn Semester 2017 Friday

NJIT Department of Computer Science PhD Qualifying Exam on CS 631: DATA MANAGEMENT SYSTEMS DESIGN. Summer 2012

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

Solutions to Final Examination

The appendix contains information about the Classic Models database. Place your answers on the examination paper and any additional paper used.

Introduction to Databases Exam

Database Management Systems Paper Solution

VIEW OTHER QUESTION PAPERS

Bachelor in Information Technology (BIT) O Term-End Examination

Queen s University Faculty of Arts and Science School of Computing CISC 432* / 836* Advanced Database Systems

Homework 3: Relational Database Design Theory (100 points)

IMPORTANT: Circle the last two letters of your class account:

CMSC 461 Final Exam Study Guide

IMPORTANT: Circle the last two letters of your class account:

Birkbeck. (University of London) BSc/FD EXAMINATION. Department of Computer Science and Information Systems. Database Management (COIY028H6)

Name :. Roll No. :... Invigilator s Signature : DATABASE MANAGEMENT SYSTEM

MCA (Revised) Term-End Examination June, 2013 MCS-023 : DATABASE MANAGEMENT SYSTEMS. Time : 3 hours Maximum Marks : 100 (VVeightage 75%)

Northern India Engineering College, New Delhi Question Bank Database Management System. B. Tech. Mechanical & Automation Engineering V Semester

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design

GUJARAT TECHNOLOGICAL UNIVERSITY

DATABASE MANAGEMENT SYSTEMS

CSE 344 Final Examination

VANCOUVER ISLAND UNIVERSITY CSCI 370 FINAL EXAMINATION 17 April 2009, 13:00 16:00

Question 1. SQL and Relational Algebra [25 marks] Question 2. Enhanced Entity Relationship Data Model [25 marks]

(a) Explain how physical data dependencies can increase the cost of maintaining an information

CSE344 Final Exam Winter 2017

CS/B.Tech/CSE/New/SEM-6/CS-601/2013 DATABASE MANAGEMENENT SYSTEM. Time Allotted : 3 Hours Full Marks : 70

McGill April 2009 Final Examination Database Systems COMP 421

Babu Banarasi Das National Institute of Technology and Management

CS 461: Database Systems. Final Review. Julia Stoyanovich

Database Management

Unit 2. Unit 3. Unit 4

CSE 444 Midterm Exam

A subquery is a nested query inserted inside a large query Generally occurs with select, from, where Also known as inner query or inner select,

Exam. Question: Total Points: Score:

Physical DB design and tuning: outline

Midterm Exam (Version B) CS 122A Spring 2017

Exam I Computer Science 420 Dr. St. John Lehman College City University of New York 12 March 2002

DBS 2006: 1 st week. DBS 2006: Plan. DB Life-Cycle: Requirement analysis. Data modelling: Conceptual Design. Logical Schema Design

DATABASE MANAGEMENT SYSTEM

CSE 444 Midterm Exam

1. (a) Explain the Transaction management in a database. (b) Discuss the Query Processor of Database system structure. [8+8]

Total No. of Questions :09] [Total No. of Pages : 02. II/IV B.Tech. DEGREE EXAMINATIONS, NOV/DEC Second Semester CSE/IT DBMS

CSE 344 Final Examination

Examination examples

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, normal forms. University of Edinburgh - January 25 th, 2016

2011 DATABASE MANAGEMENT SYSTEM

CS2255 DATABASE MANAGEMENT SYSTEMS QUESTION BANK UNIT I

M S Ramaiah Institute of Technology Department of Computer Science And Engineering

Birkbeck. (University of London) BSc/FD EXAMINATION. Department of Computer Science and Information Systems. Database Management (COIY028H6)

Example Examination. Allocated Time: 100 minutes Maximum Points: 250

The University of British Columbia

Sample Exam for CSE 480 (2017) KEY

IMPORTANT: Circle the last two letters of your class account:

NOTE 1: This is a closed book examination. For example, class text, copies of overhead slides and printed notes may not be used. There are 11 pages.

CS 564 Final Exam Fall 2015 Answers

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

Midterm 2: CS186, Spring 2015

Computer Science 597A Fall 2008 First Take-home Exam Out: 4:20PM Monday November 10, 2008 Due: 3:00PM SHARP Wednesday, November 12, 2008

CSE 344 Final Examination

Introduction. Examination, INF3100, No examination support material is allowed

B.C.A DATA BASE MANAGEMENT SYSTEM MODULE SPECIFICATION SHEET. Course Outline

Lecture 11 - Chapter 8 Relational Database Design Part 1

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

CSE 444, Fall 2010, Midterm Examination 10 November 2010

Relational Database Design (II)

COMP302. Database Systems

CSE 344 Final Examination

The University of British Columbia Computer Science 304 Practice Final Examination

Rajiv GandhiCollegeof Engineering& Technology, Kirumampakkam.Page 1 of 10

UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division

CS6302- DATABASE MANAGEMENT SYSTEMS- QUESTION BANK- II YEAR CSE- III SEM UNIT I

Sample Exam for CSE 480 (2016)

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity

CS145 Final Examination

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

Schema And Draw The Dependency Diagram

City University of Hong Kong Course Syllabus. offered by Department of Computer Science with effect from Semester A 2017/18

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, Normal Forms. University of Edinburgh - January 30 th, 2017

Database Systems Management

CS 338 Functional Dependencies

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu.

DC62 Database management system JUNE 2013

CS145 Midterm Examination

Do not turn over until you are told to do so by the invigilator. Module Contact: Dr. Beatriz de la Iglesia (CMP)

Alternate Exam for CSE 480 (2017) KEY

Database Management Systems (Classroom Practice Booklet Solutions)

SECOND SEMESTER BCA : Syllabus Copy

CPSC 310: Database Systems / CSPC 603: Database Systems and Applications Final Exam Fall 2005

Administrivia. CS186 Class Wrap-Up. News. News (cont) Top Decision Support DBs. Lessons? (from the survey and this course)

COSC Dr. Ramon Lawrence. Emp Relation

ADVANCED DATABASES ; Spring 2015 Prof. Sang-goo Lee (11:00pm: Mon & Wed: Room ) Advanced DB Copyright by S.-g.

CSE 444, Winter 2011, Midterm Examination 9 February 2011

SYED AMMAL ENGINEERING COLLEGE

15CS53: DATABASE MANAGEMENT SYSTEM

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 6 Normalization of Database Tables

FUNCTIONAL DEPENDENCIES CHAPTER , 15.5 (6/E) CHAPTER , 10.5 (5/E)

Goals for Today. CS 133: Databases. Final Exam: Logistics. Why Use a DBMS? Brief overview of course. Course evaluations

Transcription:

Department of Computer and Information Science Examination paper for TDT4145 Data Modelling and Database Systems Academic contact during examination: Svein Erik Bratsberg: 99539963 Roger Midtstraum: 99572420 Examination date: 6th of August 2014 Examination time (from-to): 09:00 13:00 (9am 1pm) Permitted examination support material: D No written and handwritten examination support materials are permitted. A specified, simple calculator is permitted. Other information: Language: English Number of pages: 5 Number of pages enclosed: 0 Checked by: Date Signature

Problem 1 Data Models (20 %) a) (3 %) Cardinality constraints in ER models can be expressed as shown in the diagram below. Explain the constraints that can be expressed by x, y, s and t. b) (5 %) In the ER diagram below we have shown an ER model, which use a category. Show how this ER model can be translated into a relational schema that matches the ER model as closely as possible. c) (12 %) Make an Entity-Relationship diagram for the following case. You may use all ER modelling concepts from the curriculum. I Nice you can rent city bikes. In the city centre there is a number of cycle stations with locking terminals to accommodate a number of city bikes. In order to be able to rent bikes you have to register a cellular phone number, your name and a credit card. When you want to rent a bike, you use your registered phone and call a phone number that is displayed at the locking terminal where your chosen bike is locked. If your request is granted, the bike is unlocked and you are charged for the time you have access to the bike. When you are done using the bike, you hand it in by locking the bike at a vacant locking terminal. Every bike has a unique RFID chip that is recognised by the locking terminal, which terminates your rent when the locking procedure has been completed. The company that runs the bike rental service wants to have information about where vacant bikes are locked, the bikes that are rented, the registered users, the users who have rented a bike at the moment, and all completed rentals. The database must contain the necessary information to document the users use of the bike rental service. There are different types of bikes and the system also records when a new bike is put to use in the service. State any assumptions you find necessary. Page 2 of 5

Problem 2 Relational Algabra and SQL (20 %) Use the following relational database (primary keys are underlined), which is designed to store data for a simple student-subject-exam application: Student(StudentNo, Name, Email) Subject(SubjectNo, Name) Exam(ExamNo, SubjectNo, Year, Month, Date) SubjectNo is a foreign key against the Subject table. SubjectNo is not allowed to have the NULL value. ExamRegistration(StudentNo, ExamNo, Grade) StudentNo is a foreign key against the Student table. StudentNo is not allowed to have the NULL value. ExamNo is a foreign key against the Exam table. ExamNo is not allowed to have the NULL value. Data is entered when a student registers for an exam. Grade has the NULL value until the grading process is completed. Relational algebra can be stated as text or graphs. If you master both notations we encourage you to state the answers in the graphical form. However, a correct query stated as text will get full score. a) (4 %) Make an ER model (you may use any ER construct in the curriculum) that matches the relational schema as closely as possible. State any assumptions you find necessary. b) (3 %) Write a query in relational algebra that finds StudentNo, Name and Email for all students who were registered for one of the exams, which took place on 26 th of May 2014. c) (3 %) Write a query in relational algebra that finds all students who aren t registered for any exam in 2014. In the result you should show StudentNo, Name and Email. d) (3%) Write a query in SQL that finds all subjects, which have at least one exam in 2014. The result should have columns SubjectNo and Name, there should be no duplicates in the result, and the result table should be sorted on SubjectNo in ascending order. e) (3 %) Write a query in SQL that finds the number of times the grade A has been awarded since the subject was created, in each subject, which has had one or more exams during 2014. The result table is supposed to have the columns SubjectNo, Name and Number of A. The result should be sorted on Number of A in descending order. f) (4 %) Assume that all foreign keys are defined with the constraint ON DELETE RESTRICT or ON DELETE NO ACTION (these are equal). We want to delete the student with StudentNo 100. Show how this can be done in SQL. Page 3 of 5

Problem 3 Theory (20 %) a) (4 %) Consider R = {A, B, C, D, E} and F = {AB->C, C->E, AE->B}. The closure AB + = ABCE. Explain what this means. Find all candidate keys for the table R. You must explain your answer. b) (6 %) The table R = {A, B, C D} is decomposed into R1 = {A, C} and R2 = {B, C, D}. Find a set of functional dependencies, F, which guarantees that this decomposition has the lossless-join property. Using your F, find all candidate keys and the highest normal form for the three tables R, R1 and R2. You have to justify your answer. c) (4 %) Consider R = {A, B, C, D, E} and F = {A->B, B->C, C->D, D->E}. Assume that R fulfils 1 st normal form. Find the highest normal form that is satisfied by R. You have to justify your answer. d) (6 %) Consider R = {A, B, C, D, E} and F = {A->B, B->C, C->D, D->E}. Assume that R fulfils 1 st normal form. If necessary, make a decomposition of R so that all component tables satisfy Boyce-Codd normal form (BCNF). The decomposition should have the loss-less join property, preservation of attributes and preservation of functional dependencies. You have to justify your answer. Problem 4 Extendible hashing (10 %) We are to insert the following keys in a hash file using extendible hashing in the given sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. It is space for maximum two keys in each block. Show the state of the hash file at the end. Assume there to be 4 blocks when you start inserting keys and the hash function to be h(k) = K MOD 16. Please include "global depth" and "local depth". Problem 5 Storage and query processing (15 %) Assume the following table: CREATE TABLE Employee (empno INT, lastname CHAR(30), firstname CHAR(30), email CHAR(30), startyear INT); We have the following types of storage and indexes 1. Heap file 2. Clustered B+-tree 3. Unclustered B+-tree and heap file 4. Clustered hash file 5. Unclustered hash file and heap file For each of the SQL queries below explain which storage / index type is best. When you make use of an index, describe which attribute is indexed. Explain your answers. Page 4 of 5

i) INSERT INTO Employee VALUES (12123,'Hansen','Hans','hans@email.org',2013); ii) SELECT lastname, firstname, email, startyear FROM Employee WHERE startyear=2012; iii) SELECT * FROM Employee; iv) SELECT DISTINCT lastname FROM Employee ORDER BY lastname; v) UPDATE Employee SET startyear = 2012 WHERE empno=12123; Problem 6 Transactions - SERIALIZABLE (5 %) Explain which concurrency problems we avoid by using SQL s isolation level SERIALIZABLE. Problem 7 Transactions schedule and locks (10 %) a) Look at the sequence of operations from two transactions, T1 and T2, described in the table below. What is the problem with this sequence of operations? T1 Read(X); X := X N; Write(X); Read(Y); Y := Y N; Write(Y); T2 Read(X); X := X+M; Write(X); b) By introducing conservative 2PL (two phase locking), show how the sequence of operations becomes. Page 5 of 5