A7-R3

18
A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS JANUARY-2006 JULY-2004 JANUARY- 2006 TOTAL TIME: 3 HOURS TOTAL MARKS: 100 (PART ONE-40; PART TWO – 60) PART ONE (Answer all the questions) 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10) 1.1 Pick the odd one out A) Primary key B) Super key C) Candidate key D) Foreign key 1.2 Relational Algebra is A) Data Definition Language B) Meta Language C) Procedure query language D) Non procedural language 1.3 One of the following is a valid record-based data models A) Object-oriented model B) Relational model C) Entity-relationship model D) None of the above 1.4 One of the following steps is not involved in processing a query A) Parsing and translation B) Optimization C) Evaluation D) Distribution

Transcript of A7-R3

Page 1: A7-R3

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

• JANUARY-2006

• JULY-2004

JANUARY- 2006

TOTAL TIME: 3 HOURS TOTAL MARKS: 100

(PART ONE-40; PART TWO – 60)

PART ONE (Answer all the questions)

1. Each question below gives a multiple choice of answers. Choose the most appropriate

one and enter in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

1.1 Pick the odd one out A) Primary key B) Super key C) Candidate key D) Foreign key 1.2 Relational Algebra is A) Data Definition Language B) Meta Language C) Procedure query language D) Non procedural language 1.3 One of the following is a valid record-based data models A) Object-oriented model B) Relational model C) Entity-relationship model D) None of the above 1.4 One of the following steps is not involved in processing a query A) Parsing and translation B) Optimization C) Evaluation D) Distribution

Page 2: A7-R3

1.5 Which one of the following describes the timestamp-based protocols correctly? A) This protocol requires that each transaction issue lock and unlock requests in two phases. B) This protocol employs only exclusive locks. C) This protocol selects an ordering among transaction in advance. D) None of the above 1.6 Which one of the following is not a valid relational database? A) SYBASE B) ORACLE C) IMS D) UNIFY 1.7 4NF is designed to cope with A) transitive dependency B) join dependency C) multi valued dependency D) none of these 1.8 Which one of the following is a valid join type? A) natural B) full outer join C) on D) using 1.9 Which one of the following is not a valid aggregation function in SQL? A) avg B) min C) where D) sum 1.10 Which of the following is not a valid unary operation in the relational algebra? A) select B) min C) project D) rename

Page 3: A7-R3

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and

ENTER in the “tear-off” sheet attached to the question paper, following instructions therein. (1 x 10)

2.1 A relationship is an association among several entities.

2.2 Physical data models are used to describe data at the highest level.

2.3 QBE is based on the tuple relational calculus.

2.4 The database schema and the database instance are the same thing.

2.5 Functional dependencies are constraints on the set of legal relations.

2.6 Integrity constraint guard against accidental damage to the database.

2.7 One-way to ensure serializability is to require that access to data items be done in a mutually | exclusive manner.

2.8 The cost of processing a query is not dependent on disk access.

2.9 The recovery scheme does not depend on the concurrency control scheme.

2.10 Deadlocks can be described precisely in terms of a directed graph. 3. Match words and phrases in column X with the closest related meaning/

word(s)/phrases in column Y. Enter your selection in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

X Y

3.1 Dense index A. data are represented by collection of records and relationship among data are represented by links

3.2 Transaction B. Query language based on both the relational algebra and the tuple relational calculus

3.3 Shadow Paging C. The index structure is the most widely used to several index structures that maintain their efficiency despite insertion and deletion of data

3.4 Referential integrity constraint

D. A record appears for every search key value in the file

3.5 Committed E. A recovery technique

3.6 B+ tree index F. This ensures that a value that appears in one relation for a given set of attributes also appears for a certain set of attribute in another relation

3.7 Network Model G. The successful completion of a transaction

3.8 Entity H. A unit of program execution that accesses and possibly updates various data items

3.9 DMI I. A powerful declarative query language

3.10 Embedded SQL J. An object in the real world that is distinguishable from all other objects

K. The number of entities to which another entity can be associated via a relationship set

L. BCNF

Page 4: A7-R3

4. Each statement below has blank space to fit one of the word(s) or phrases in the list

below. Enter your choice in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

A. merge-join B. natural join C. starvation

D. rollback E. from F. replicate

G. cartesian product H. relational algebra I. fragmented

J. ordered K. transaction L. division

M. hash N. trigger O. super key

4.1 The ___________________ operation allows to combine information from any tow relations.

4.2 A(n) ____________________ is a statement that is executed automatically be the system as

a side effect of a modification to the database.

4.3 The __________________ algorithm can be used to compute natural joins and equi-joins.

4.4 If a relation is ___________________ a copy of that stored in two or more sites.

4.5 A(n) ________________________ is a set of one or more attributes that taken collectively

allows us to identify uniquely an entity in the entity set.

4.6 A(n) ________________________ is a collection of operations that performs a single logical

function in a database application.

4.7 The _________________________ clause by itself defines a Cartesian product of the

relations in the clause.

4.8 ___________________________ indices are based on the values being distributed

informally across a range of buckets.

4.9 The ___________________ is a situation where a transaction never completes its

designated task.

4.10 The ____________________ operation is suited to queries that include the phase “for all”.

PART TWO (Answer any FOUR questions)

5. a) Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors.

Associate with each patient a log of the various tests and examinations conducted. b) Explain the advantages and disadvantages of Database Processing?

(10+5) 6. a) List and explain with suitable example five primary relational algebra operators. b) What is meant by Heuristic Optimization? Discuss the main heuristics that are applied to

query optimization?

Page 5: A7-R3

(10+5) 7. a) Consider the insurance database given below: person (driver-id, name, address)

car (license, model, year) accident (report-number, date, location) owns (driver-id, license) participated (driver-id, car, report-number, damage-amount) Construct the following SQL queries for this relational database. i) Find the total number of people who owned cars that were involved in accidents in

2004. ii) Find the number of accidents in which the cars belonging to “Thakre” were involved. iii) Delete the Mazda belonging to “S Khan”.

b) How does SQL allow implementation of entity and integrity constraints? (9+6)

8. a) List and explain Armstrong’s Axioms. b) Explain the purpose and utility of different normal forms. Specifically define and differentiate

between third normal form and BCNF. c) What is referential integrity? Explain with suitable examples.

(5+5+5) 9. a) Explain ACID property of transactions. b) What do you understand by lock granularity? Explain c) Explain in brief working of two-phase locking protocol.

Page 6: A7-R3

JULY-2004

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

NOTE:

1. There are TWO PARTS in this Module/paper. PART ONE contains FOUR questions and PART TWO contains FOUR questions.

2. PART ONE is to be answered in the TEAR-OFFANSWER SHEET only, attached to the

question paper, as per the instructions contained therein. PART ONE is NOT to be answered in the answer book.

3. Maximum time allotted for PART ONE is ONE HOUR. Answer book for PART TWO will be

supplied at the table when the answer sheet for PART ONE is returned. However, candidates who complete PART ONE earlier than one hour, can collect the answer book for PART TWO immediately after handing over the answer sheet for PART ONE.

TOTAL TIME: 3 HOURS TOTAL MARKS: 100 (PART ONE-40; PART TWO – 60)

PART ONE

(Answer all the questions) 1. Each question below gives a multiple choice of answers. Choose the most appropriate

one and enter in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

1.1 In AN E-R, Y is the dominant entity and X is a subordinate entity. Then which of the following

is incorrect A) operationally, if Y is deleted, so it X. B) X existence is dependent on Y. C) operationally, if X is deleted, so is Y. D) operationally, if X is deleted, Y remains the same. 1.2 Assume transaction A holds a share lock R. If a transaction B also requests for a shared lock

on R, A) It will result in deadlock situation. B) It will immediately be granted. C) It will immediately be rejected. D) It will be granted as soon as it is releases by A. 1.3 Which of the following is correct A) a SQL query automatically eliminates duplicates. B) SQL permits attribute names to be repeated in the same relation. C) a SQL query will not work if there are no indexes on the relations. D) none of the above. 1.4 Data security threats include A) private invasion B) hardware protection C) fraudulent manipulation of data. D) all of the above 1.5 A race condition occurs when A) two concurrent activities interact to cause a processing error. B) two users of the DBMS are interacting with different files at the same time. C) both A and B D) none of the above.

Page 7: A7-R3

1.6 Consider the join of a relation R with a relation S. If R has m tuples and S has n tuples. Then

the maximum and minimum size of the join respectively are A) m+n and 0 B) m+n and |m-n| C) mn and 0 D) mn and m+n 1.7 In a multiuser database, if two users wish to update the same record at the same time, they

are prevented by doing so by A) jamming B) password C) documentation D) record-lock 1.8 If every non-key attribute is functionally dependent on the primary key, then the relation will

be in A) 1NF B) 2NF C) 3NF D) 4NF 1.9 R(A,B,C,D) is a relation, Which of the following does not have a lossless join dependency

preserving BCNF decomposition A) A→B, B→CD B) A→B, B→C, C→D C) AB→C, C→AD D) A→BCD 1.10 Consider the schema R{S,T,U,V} and the dependencies S→T, T→U, U→V, V→S. Let

R={R1, R2} such that R1∩R2=Φ. Then the decomposition is A) not 2NF but not in 3NF B) in 2NF but not in 3NF C) in 3NF but not in 2NF D) in both 2NF and 3NF

Page 8: A7-R3

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and

ENTER in the “tear-off” sheet attached to the question paper, following instructions therein. (1 x 10)

2.1 Data items are composed of data elements.

2.2 A record in 3NF is better than a record to 1NF from a relational mathematics point of view.

2.3 Generalized DBMS do not retrieve data to meet routine requests.

2.4 A relation R with schema (x, y) satisfies the FDs x→y, the tuples <1, 2> and <2, 2> can both be in R simultaneously.

2.5 A relational database which is 3NF may still have undesirable data redundancy because there may exists non trival FDs involving prime attributes only on left side.

2.6 Transferring data in blocks from the main memory to the cache memory enables an interleaved main memory unit to operate at its maximum speed.

2.7 There is always decomposition into BCNF that is lossless and dependency preserving.

2.8 The step verb is used to specify the increment in a loop in PL/SQL

2.9 Commit can be fired upto a savepoint.

2.10 B-Tree are for storing data on disk and B+-Tree are for main memory. 3. Match words and phrases in column X with the closest related meaning/

word(s)/phrases in column Y. Enter your selection in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

X Y

3.1 hierarchical database model A. Organization of a database in its entirety

3.2 record B. Major limitation of file management systems

3.3 database administrator C. Contains all the information about elements of data stored in a database

3.4 schema D. In this database model, each record can have more than one parent

3.5 transaction log E. Record of all activity that has affected a database during a period of time

3.6 database F. Hierarchical database model

3.7 data redundancy G. Using this approach means that applications software programs can access data from only a single file at a time

3.8 data dictionary H. Specifies exactly how data will be arranged and stored on a storage device for use by the DBMS

3.9 database management system I. Collection of related files

3.10 network database model J. A major advantage in using a database management system

K. This person or group coordinates all related activities to control a database in an organization

L. Group of related fields

M. This model is composed of parent and child records (one parent to more than one child)

N. Software tool that facilitates creation and maintenance of database

O. The most popular type of database model used on microcomputers

Page 9: A7-R3

4. Each statement below has blank space to fit one of the word(s) or phrases in the list below. Enter your choice in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

A. Larger B. INSERT C. Parallel search

D. Database E. Database Trigger F. Lost update

G. Inconsistent data H. 60% I. Record

J. Smaller K. Operating System L. 3NF

M. Users N. R-(R-S) O. Active data set

P. (U,-) Q. Base register addressing R. Tree

4.1 Suppose the domain set of an attribute consists of signed 4-digit numbers. There will be

_________ of reduction in the storage of this attribute, if it is stored as an integer rather then

character form.

4.2 Data items grouped together for storage purposes are called _________.

4.3 In a virtual memory system the address space specified by the address lines of the CPU

must be _________ then the physical memory size and smaller than the secondary size.

4.4 The DBA is, in effect, the co-ordinator between _________ and the users.

4.5 Give a relational algebra expression using only the minimum number of operators from (U,-)

which is equivalent to R^S _________.

4.6 The _________ operation can not be performed using views when the defination includes

more than one table.

4.7 The REVOKE command can not be used to revoke the privileges granted through the

_________.

4.8 The data stored in cursor is called _________.

4.9 _________ are PL/SQL blocks that fire when an insert, update or delete performed on

database.

4.10 _________ mode permits relocation without any change whatsoever the code.

PART TWO

Page 10: A7-R3

(Answer any FOUR questions)

5.

a) Explain the recovery procedure that needs to take place after disk crash.

b) Compare the two log-based recovery scheme in terms of ease of implementation and overhead cost.

(7+8)

6.

a) How does SQL allow implementation of entity, integrity and referential integrity constraints?

b) Define the following terms

i) association

ii) relationship

iii) aggregation

iv) specialization

v) generalization

vi) logical and physical independence

(9+6)

7. Consider a relation TENANT (NAME, CITY, STREET#, APT#, APT-TYPE, RENT, LANDLORD, ADDRESS), Where following functional dependencies hold

APT# STREET# CITY ADDRESS

ADDRESS APT-TYPE

NAME ADDRESS RENT

LAND-LORD APT-TYPE RENT

i) Are the following relation scheme in 3NF?

APARTMENT (APT-TYPE, ADDRESS, RENT)

DWELLER (NAME, ADDRESS, RENT)

ii) What updating and insertion anomalies do you foresee in TENANT, APARTMENT & DWELLER relations.

iii) Do the APARTMENT & DWELLER relations have lossless join?

iv) Find a key of this relation. How many keys does TENANT have?

v) Find the decomposition of TENANT into 3NF having lossless join and preserving dependencies.

(3x5)

8.

a) What is the highest normal form of each of the following relations?

i) R1 (A, B, C) with A→B, A→C, C→B

ii) R1 (A, B, C, D) with A→BC, CD→B

iii) R1 (A, B, C, D, E) with A→BC, E→A, CD→E

Find the candidate keys for each of these relations.

b) Find a 3NF decomposition of the following relation scheme: (Faculty, Dean, Department, Chairperson, Professor, Rank, Student). The relation satisfies the following functional dependencies (and any others that are logically implied by these):

Page 11: A7-R3

Faculty → Dean

Dean → Faculty

Department → Chairperson

Professor → RankChairperson

Department → Faculty

Student → DepartmentFacultyDean

ProfessorRank → DepartmentFaculty

(8+7)

9.

a) Define the BCNF? How does it differ from 3NF? Why is it considered a stronger form of 3NF?

b) What is meant by the term heuristic optimization? Discuss the main heuristic that are applied during query optimization.

c) Can a transaction be aborted? Explain in brief.

(5+5+5)

Page 12: A7-R3

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

NOTE:

1. There are TWO PARTS in this Module/paper. PART ONE contains FOUR questions and PART TWO contains FOUR questions.

2. PART ONE is to be answered in the TEAR-OFFANSWER SHEET only, attached to

the question paper, as per the instructions contained therein. PART ONE is NOT to be answered in the answer book.

3. Maximum time allotted for PART ONE is ONE HOUR. Answer book for PART TWO

will be supplied at the table when the answer sheet for PART ONE is returned. However, candidates who complete PART ONE earlier than one hour, can collect the answer book for PART TWO immediately after handing over the answer sheet for PART ONE.

TOTAL TIME: 3 HOURS TOTAL MARKS: 100

(PART ONE-40; PART TWO – 60)

PART ONE

(Answer all the questions) 1. Each question below gives a multiple choice of answers. Choose the most

appropriate one and enter in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

1.1 The DMLs which require a user to specify what data is needed and how to get it, is

called A) DDL DMLs B) Procedural DMLs C) Nonprocedural DMLs D) None of the above 1.2 One of the following is not an object-based logical model. A) The binary model B) The entity-relational model C) The infological model D) None of the above. 1.3 A super key is a set of one or more attributes that, taken collectively, allow us A) to identify uniquely an entity in the entity set. B) to make the key most powerful for faster retrieval. C) to increase effectiveness of database access. D) None of the above. 1.4 Which one of the following is binary operation? A) project B) select C) rename D) None of the above

Page 13: A7-R3

1.5 Consider P1 and P2 are formulae. Which one of the following is correct ?

A) P1 ^ P2 is equivalent to ¬ (P1 V ¬ (¬P2))

B) P1 ^ P2 is equivalent to ¬ (¬(P1) V ¬ (P2))

C) P1 ^ P2 is equivalent to ¬ (¬(P1) V ¬ (¬P2)) D) None of the above. 1.6 Which clause from the following corresponds to the projection operation of the

relational algebra. A) from B) select C) where D) None of the above. 1.7 Which one of the clause is useful in defining the notion of tuple variables? A) as B) by C) from D) None of the above. 1.8 The intersect operation A) automatically eliminates duplicates. B) automatically eliminates duplicates, if we provide all clause with intersect. C) never eliminates duplicates. D) None of the above. 1.9 A table is in 2NF if it is in 1NF and if A) no column that is not a part of the primary key is dependent on only a portion of the

alternate key. B) no column that is not a part of the primary key is dependent on only a portion of the

primary key. C) no column that is not a part of the primary key is dependent on only a portion of the

foreign key. D) None of the above. 1.10 The JOIN command in the relational algebra combines data from two tables based

on A) common rows. B) common columns. C) Predefine rules D) None of the above.

Page 14: A7-R3

2. Each statement below is either TRUE or FALSE. Choose the most appropriate

one and ENTER in the “tear-off” sheet attached to the question paper, following instructions therein. (1 x 10)

2.1 A conceptual level is a lowest level of data abstraction and describes how the data are actually stored.

2.2 Aggregate functions take a collection of values and returns one or more than one value as a result.

2.3 DECLARE is an executable statement.

2.4 Column constraints are specific to a column in a base table.

2.5 The order by clause lists items in descending order.

2.6 Unique index can occur only one per table in database.

2.7 The DELETE statement is used to delete an existing column or columns from a table.

2.8 ODBC means Open Database Connectivity.

2.9 Database design is the process of determining an appropriate database structure to satisfy a given set of requirements.

2.10 Firewall can be considered as a single point control on a network. 3. Match words and phrases in column X with the closest related meaning/

word(s)/phrases in column Y. Enter your selection in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

X Y

3.1 File manager A. graphical means of modeling various software components

3.2 Query processor B. host language

3.3 UML C. (¬ (P1) V P2)

3.4 Outer join D. encoding data

3.5 P1 ⇒ P2 E. ¬ (P1) V P2)

3.6 Aggregate functions F. correctness and completeness of the data in a database

Page 15: A7-R3

3.7 Embedded SQL G. decoding data

3.8 OPEN H. allocation of space on disk storage

3.9 Encryption I. allocation of time for disk storage

3.10 Data integrity J. deal with voluminous information

K. deal with missing information

L. return a single function

M. return multiple functions

N. low-level instructions for database manager

O. Makes the cursor ready for row retrieval

4. Each statement below has blank space to fit one of the word(s) or phrases in

the list below. Enter your choice in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

A. with B. form C. discriminator

D. recovery manager E. static F. object

G. attributes H. password I. shadow

J. uncommitted K. authorization L. association

M. dynamic N. class O. aggregation

P. database manager Q. committed R. entity

4.1 An entity is an object that is distinguishable from other objects by a specific set of

__________.

4.2 The primary key of a weak entity set is formed by the primary key of the identifying

entity set, plus the weak entity set’s __________.

4.3 A(n) __________ is an abstraction through which relationships are treated as higher

level entities.

4.4 The __________ clause permits a view definition to be used in multiple places within

a query.

4.5 The __________ SQL component of SQL allows programs to construct and submit

SQL queries at run time.

Page 16: A7-R3

4.6 A cursor is an SQL __________ that is associated with a specific table expression.

4.7 In __________ paging, transaction logs are not required.

4.8 The __________, restores the database to a consistent state.

4.9 The undo logs rollback __________.

4.10 A(n) __________ granting of a privilege to a user.

PART TWO (Answer ALL questions)

5.

a) List advantages and disadvantages of database processing. Explain one of the advantages and one of the disadvantages.

b) Explain the following terms with reference to DBMS

i) relation

ii) relational database

iii) a normalized relation

c) What is DBA (Data Base Analysis)? What is the role of DBA in regard to security?

(5+6+4)

6.

a) List the rules that an OLAP system should follow.

b) Explain the following in brief:

i) What are stored procedures?

ii) What is data fragmentation?

iii) What is the difference between file server and a client/server system?

iv) What are triggers? What purpose do they serve?

(7+8)

Page 17: A7-R3

7.

a) While selecting DBMS, what are the checklist points one has to study for each of the following?

i) Security

ii) Integrity

iii) Data Reconstructing

iv) Data Definition

b) Assuming that you are using DBMS that provides the locking facilities. How programs be written to

i) avoid deadlock

ii) guarantee correct results.

c) What is deadlock? How does it occur?

(8+4+3)

8.

a) Describe the function of each of the following types of keys:

primary, alternative, secondary and foreign.

b) Explain third normal form with example.

c) Describe the GRANT function and explain, how it relates to security. What types of privileges may be granted? How are they revoked?

(6+4+5)

9. Assume the following tables:

degreedegreedegreedegree (degcode, name, subject)

candidatecandidatecandidatecandidate (seatno, degcode, name, semester, month, year, result)

marksmarksmarksmarks (seatno, degcode, semester, month, year, papcode, marks)

In the degree table, degcode is the degree code, name is the name of the degree (e.g. M.Sc., M.Com. etc.) and subject is the subject of the course (e.g. Physics, Math etc.). In the marks table papcode is the paper code (e.g. A-1, A-2 etc.)

Solve the following queries using SQL:

i) Write a SELECT statement to display all the degree codes which are there in the candidate table but not present in the degree table in the order of degcode.

ii) Write a SELECT statement to display the names of all candidates who have appeared for their M.Sc. (Phys) examination in the order of name.

iii) Write a SELECT statement to display the name, subject and number of candidates for all degrees in which there are less than 5 candidates.

Page 18: A7-R3

Iv) Write a SELECT statement to display the names of all the candidates who have got less than 40 marks in exactly two subjects.

v) Write a SELECT statement to display the names of all the candidates who have got highest total marks in M.Sc. (Math).

(5x3)