Sie sind auf Seite 1von 14

MODEL TEST PAPER DATABASE MANAGEMENT SYSTEM MBA III A+B Q1 Differentiate between physical data dependence and

logical data dependence. Basis of Difference 1. Meaning Logical data independence The ability to change the logical schema without changing the external schema or application programs is called as Logical Data Independence Physical data independence The ability to change the physical schema without changing the logical schema is called as Physical Data Independence.

2. Example

The external scheme may stay unchanged for most changes of the logical scheme. This is especially desirable as the application software does not need to be modified or newly translated.

The logical scheme stays unchanged even though the storage space or type of some data is changed for reasons of optimization or reorganization.

Q2 Differentiate between serial and serializable schedule. Basis of Difference 1. Meaning Serial Schedule A schedule where the operations of each transaction are executed consecutively without any other interference from other transactions is called a serial schedule. Only one transaction is being executed at any given time. Serializable schedule When the non-serial schedule produces the same results as some serial execution it is called serializable schedule. Many transactions are executed concurrently.

2. Execution of transactions

3. Serializibility

Serializibility is not required.

Serializibility is required to prevent inconsistency from transactions interfering with one another.

Q3 How object oriented DBMS differs from relational DBMS? Briefly describe atleast two differences. Basis of Difference 1. Meaning RDBMS A Relational Database Management System (RDBMS) is also a DBMS but, that is based on the relational model. OODBMS An Object-Oriented Database Management System (OODBMS), sometimes referred as Object Database Management System (ODMS) is a Database Management System (DBMS) that supports modeling and creation of data as objects.

2. Storage of data

Data is stored in form of tables also known as relations.

OODBMS is a DBMS which allows information to be represented in the form of objects as used in object-oriented programming

3. Independence

Data independence: Data can be reorganized and modified without affecting the mode of using them.

Independence of classes: classes can be reorganized without affecting the mode of using them.

Q4 What are responsibilities of DBA? DBA performs following functions: 1. Defining the conceptual schema: It is the data administrators job to decide exactly what information is to be held in the database i.e. to identify the entities

2. 3. 4.

5.

6.

of interest to the enterprise and to identify the information to be recorded about those entities. Defining the internal schema: DBA is responsible for the definition and implementation of the internal level, including the storage structure and access methods to be used for the optimum performance of the DBMS. Liaising with users: It is the business of the DBA to liaise with users to ensure that the data they need is available and further specifies the external view of the various users and applications. Defining security and integrity constraints: DBA is responsible for granting permission to the users of the database so that it is not accessible to unauthorized users. Moreover measures are taken to maintain integrity of database i.e. to prevent entry of irrelevant data. Defining dump and Reload policies: The DBA must define and implement an appropriate damage control scheme, typically involving (a) Periodic unloading or dumping of the database to backup storage. (b) Reloading the database when necessary from the most recent dump. Monitoring performance and responding to changing requirements: DBA is responsible for organizing the system in such a way as to get the performance that is best for the enterprise and making the appropriate adjustments as per changing needs.

Q5 Draw the various levels of a database system and explain the role of each of these levels. The various levels of a database system are as follows: External or user level Conceptual or global level Internal or physical level

External level The users view of the database. Consists of a number of different external views of the DB. Describes part of the DB for particular group of users. Provides a powerful and flexible security mechanism by hiding parts of the DB from certain users. The user is not aware of the existence of any attributes that are missing from the view. It permits users to access data in a way that is customized to their needs, so that the same data can be seen by different users in different ways, at the same time.

Conceptual level The logical structure of the entire database. What data is stored in the database. The relationships among the data. Complete view of the data requirements of the organization, independent of any storage consideration. Represents: - entities, attributes, relations - constraints on data - semantic information on data - security, integrity information Supports each external view: any data available to a user must be contained in, or derivable from the conceptual level.

Internal Level Physical representation of the DB on the computer. How the data is stored in the database. Physical implementation of the DB to achieve optimal runtime performance and storage space utilization. - Storage space allocation for data - Record description for storage - Record placement - Data compression, encryption

Q6 List various types of relations & their notation, which can be shown in an ER diagram? There are three kinds of relations that can be shown in an ER diagram 1. one-to-one (1:1): each entity in A can be related to at most one entity in B, and vise versa.

2. many-to-many (N:N): an entity can be related to many entities in the other set, and vice versa.

3. many-to-one (N:1): each entity in A can be related to at most one entity in B, but an entity in B may be related to many entities in A.

Q7 Briefly describe hierarchical and network model. Hierarchical model In a hierarchical model, data is organized into a tree-like structure. It was the first DBMS model. One of the first hierarchical databases-Information Management System (IMS) was developed by North American Rockwell Company and IBM. IMS became the worlds leading mainframe hierarchical database system in the 1970s and early 1980s. The database keeps track of the different record types, their attributes, and the hierarchical relationships between them. The attribute which assigns records to levels in the database structure is called the key . This model is having a parent child relationship. The record type at the top of the tree is known as the root. Root may have any number of dependents, each of these may have any number of lower level dependents, and so on. Depicts a set of one-to-many (1: M) relationships between a parent and its children segments o Each parent can have many children o Each child has only one parent For example

Network model Developed in mid 1960s as part of work of CODASYL (Conference on Data Systems Languages) which proposed programming language COBOL (1966) and then network model (1971) . In network database terminology, a relationship is a set. Each set is made up of atleast two types of records: an owner/superior/parent record and a member/dependent/child record. Links are hierarchical relations between records of two types. It allows a given record type may have any number of superiors. A superior can have any number of immediate dependents. This model depicts many to many relationship. For example

Q8 Consider the database Employee(e-name,street,city) Company(c-name,city,c-locn) Works(e-name,c-name,salary) Manages(e-name,manager-name) Using SQL answer the following queries: (a) Find employee names who live in same city and on same street as do their managers. SELECT e. e-name from employee e, employee f, manages m where e.e-name=m.ename AND m.manager-name =f.e-name AND e.street=f.street AND e.city =f.city (b) Find count of employees staying in Delhi. Select COUNT(*) from employee where city=delhi; (c) Give all managers working in company ABC, 10% increase in salary. UPDATE works set salary = salary+salary * 0.1 where ename in (SELECT manager from manages) AND cname = abc; (d) Find all those company names, in which all Delhi employees work. SELECT cname FROM works WHERE ename in(SELECT ename FROM employee WHERE city=delhi) ; (e) Find those companies in which atleast one employee of Delhi based companies work. SELECT cname from Company WHERE City in (SELECT city FROM employee GROUP BY city HAVING COUNT(City) >= 1) Q9 Explain the logical and physical data structures of Oracle. The Oracle database has a logical layer and a physical layer. The physical layer consists of the files that reside on the disk; the components of the logical layer map the data to these physical components. Physical Layer The physical layer of the database consists of three types of files:

o Datafiles--Datafiles store the information contained in the database. You can have as few as one datafile or as many as hundreds of datafiles. The information for a single table can span many datafiles or many tables can share a set of datafiles. o redo log files--Redo log files hold information used for recovery in the event of a system failure. Redo log files, known as the redo log, store a log of all changes made to the database. This information is used in the event of a system failure to reapply changes that have been made and committed but that might not have been made to the datafiles. The redo log files must perform well and be protected against hardware failures (through software or hardware fault tolerance). If redo log information is lost, you cannot recover the system. o Control files--Control files contain information used to start an instance, such as the location of datafiles and redo log files; Oracle needs this information to start the database instance. Control files must be protected. Oracle provides a mechanism for storing multiple copies of control files. Logical Layer The logical layer of the database consists of the following elements: One or more tablespaces. The database is divided into one or more logical pieces known as tablespaces. A tablespace is used to logically group data together. For example, you can create one tablespace for accounting and a separate tablespace for purchasing. Tablespaces consist of one or more datafiles. By using more than one datafile per tablespace, you can spread data over many different disks to distribute the I/O load and improve performance

The database schema, which consists of items such as tables, clusters, indexes, views, stored procedures, database triggers, sequences, and so on.

Q10 What are stored procedures in Oracle? Briefly describe. A stored procedure is a logically grouped set of SQL and PL/SQL statements that perform a specific task. A stored procedure is a block that has been compiled and stored in one of the oracle engines system table. They are made up of: 1. a declarative part 2. an executable part 3. an optional exception handling part

Syntax of stored procedure CREATE OR REPLACE PROCEDURE[schema.]<procedurename> (<Argument>{IN,OUT,IN OUT}<Data type>,) {IS, AS} <Variable> declarations; <constant> declarations; BEGIN <PL/SQL subprogram body>; EXCEPTION <Exception PL/SQL block>; END;

Example using stored procedure create or replace procedure fact(a in out number) is b number:=1; begin for i in 1..a loop b:=b*i; end loop; a:=b; end; Q 11 Differentiate between varchar and char data type in oracle. Basis of Difference 1. Meaning Varchar This data type is used to store character strings values of fixed length. It can hold up to 4000 characters. The inserted values will not be padded with spaces. Varchar(size) char This data type is used to store character strings values of fixed length. The maximum number of characters this type can hold is 255 characters. The data held is right padded with spaces to whatever length specified. Char(size)

2. Maximum Characters 3. Spaces

4. Syntax

Q12 Consider the following table consisting of details about branches, customers and different loans given to them. BANK_LOANS(branch-code, branch-city, branch assets, loan-number, loanamount, customer-name, cust-address, cust-status, cust-profession) Assumptions are: (i) No two branches will have same branch-code. (ii) No two customers will have same name.

(iii) (iv) (v)

Within same branch, no two loans will have same loan-number. Every customer profession has got unique status. One loan cannot be in name of more than one customer. However one customer can have more than one loan from the same branch also.

Step by step, bring this relation to 1NF, 2NF, 3NF, BCNF. Explain each step. 1 NF To convert the table into 1NF the primary key have been defined i.e. branch-code, loan-number, customer-name. Every row can be retrieved with the help of the primary keys given above. BANK_LOANS
Branchcode Loannumber Customername Branchcity Branchassets Loanamount Custaddres s Cust- Custstatus profession

The following functional dependencies exist: {branch-code}branch-city, branch-assets {customer-name}cust-address, cust-profession {cust-profession}cust-status {branch-code, loan-number}{loan-amount, customer-name} 2 NF To convert the table into 2NF all the partial dependencies have to be removed. Checking all the above functional dependencies, we observe that there are partial dependencies in the relation. {branch-code}branch-city, branch-assets So, dividing the relation into BANK_LOANS1 and BANK_LOANS

BANK_LOANS1
Branchcode Branchcity Branchassets

BANK_LOANS

Branchcode

Loannumber

Customername

Loanamount

Custaddres s

Cust- Custstatus profession

3 NF To convert the table into 3NF all the transitive dependencies have to be removed. BANK_LOANS 1 does not have any transitive dependency so it is in 3NF. In BANK_LOANS relation we have transitive dependencies. {branch-code, loan-number}{loan-amount, customer-name} {customer-name}cust-address, cust-profession {cust-profession}cust-status All the above transitive dependencies are to be removed by dividing the relation BANK_LOANS into three relationsBANK_LOANS
Branchcode Loannumber Customername Loanamount

BANK_LOANS2
Customername Custaddres s Custprofession

BANK_LOANS3
Custprofessio n Custstatus

Q13 What are various recovery techniques in databases? Briefly describe. The various recovery techniques are as follows: 1. Deferred update techniques. Do not physically update the database on disk until after a transaction reaches its commit point. Before reaching the commit point, all transaction updates are recorded in the local transaction workspace (or buffers). During commit, the updates are first recorded persistently in the log and then written to the DB.

If a transaction fails before reaching its commit point, no UNDO is needed because it will not have changed the database anyway. If there is a crash, it may be necessary to REDO the effects of committed transactions from the Log because their effect may not have been recorded in the database. Deferred update also known as NO-UNDO/REDO algorithm.

2. Immediate update techniques. The DB may be updated by some operations of a transaction before the transaction reaches its commit point. To make recovery possible, force write the changes on the log before to apply them to the DB. If a transaction fails before reaching commit point, it must be rolled back by undoing the effect of its operations on the DB. It is also required to redo the effect of the committed transactions. Immediate update also known as UNDO/REDO algorithm. 1. Shadow Paging The DB is made up of n fixed-size disk pages -blocksA directory with n entries where the ith entry points to the ith DB page on disk. All references reads or writes- to the DB pages on disk go through the directory. The directory is kept in main memory if not too large. When a transaction begins executing, the current directory is copied into a shadow directory and the shadow directory is saved on disk The current directory entries point to the most recent or current DB pages on disk During transaction execution, all updates are performed using the current directory and the shadow directory is never modified.

Das könnte Ihnen auch gefallen