DBMS Solution Paper 2009

download DBMS Solution Paper 2009

of 4

Transcript of DBMS Solution Paper 2009

  • 7/31/2019 DBMS Solution Paper 2009

    1/4

    Solved Question Paper BCA302

    Database Management System

    Gujarat University TY BCA Solved Question Papper of April 2009 : Total Marks 70Duration : 3 hrs

    1 Answer the following. 14(A) Answer the following in 'SQL' (Any five) 103 Explain GROUP BY clause within SELECT statement.

    Answer:The group by clause is generally used when you have attribute columns combinedwith aggregate functions in the SELECT statement.

    4 Explain ADD_MONTHS, LAST_DAY function with an example.Answer:ADD_MONTHS

    Adds a number of months to a date; useful for adding months or years to adate.SYNTAX

    ADD_MONTHS (date_value, n)EXAMPLE

    SELECT P_CODE, P_INDATE, ADD_MONTHS (P_INDATE,24)FROM PRODUCTORDERBY ADD_MONTHS (P_INDATE,24);

    LAST_DAYReturns the date of the last day of the month given in a date

    SYNTAXLAST_DAY (date_value)

    EXAMPLESELECT EMP_LNAME, EMP_FNAME, EMP_HIRE_DATEFROM EMPLOYEEORDERBY EMP_HIRE_DATE >= LAST_DAY (EMP_HIRE_DATE)-7;

    6 Explain Primary key and Foreign key constraint with an example.Answer:Primary key:

    A candidate key selected to uniquely identify all other attribute value in anygiven row can not contain null entries.Foreign key:

    An attribute (or combination of attributes) in one table whose values musteither match the primary key in another table or be null.

    2 Answer the following (Any seven). 141 Define a Table and list any 3 characteristics of a Relational Table.Answer:Table:

    A table is perceived as a two dimensional structure composed of rows andcolumns.Characteristics of relational table:

    Each table row represents a single entity occurrence within the entityset.

    Each table column represents an attribute, and each column has adistinct name.

    Each row/column intersections represent a single data value.2 Define Super key and Candidate key.

    Answer:Super key:

  • 7/31/2019 DBMS Solution Paper 2009

    2/4

    An attribute (or combination of attributes) that uniquely identifies each rowin a table.Candidate key:

    A minimal super key. A super key that dose not contain a subset ofattributes that is itself a super key.

    3 What is referential integrity rule?

    Answer:If the foreign key contains either matching values or null exhibit referential

    integrity. In other word referential integrity means that if the foreign key containsa values, that value refers to an existing valid tuple (row) in another relation.

    4 Explain SELECT relational operatorAnswer:

    SELECT can be used to list all of the row values, or it can yield only thoserow values that match a specified criterion.

    5 Define right and left outer joinsAnswer:Right outer joins

    In a pair of a tables to be joined, a right outer join yields all of the rows in

    the right table, including those that have no matching values in another table.Left outer joins

    In a pair of a tables to be joined, a left outer join yields all of the rows inthe left table, including those that have no matching values in another table.

    7 Explain 1:1 and 1:M relationship within the relational database.Answer:1:1 relationship

    A retail companys management structure may require that each of it storesbe managed by a single employee. In turn, each store manager, who is anemployee, manages only a single store. Therefore, the relationship Employeemanages Store is labeled 1:1.1:M relationship

    A customer may generate many invoices, but each invoice is generated byonly a single customer. The Customer generates Invoice relationship would alsobe labeled 1: M.

    8 Define Homonyms and Synonym.Answer:Homonyms

    In a database context, the word homonyms indicate the use of the sameattribute name to label different attributes.Synonym

    Synonym is opposite of a Homonym and indicates the use of differentnames to describe the same attribute.

    3 Answer the following. 14(A) Answer any one of the following. 7

    1 What is Normalization? Define BCNF and 4NF.Answer:Normalization

    Normalization is a process for evaluating and correcting table structure tominimize data redundancies, there by reducing the likelihood of data anomalies.BCNF:

    Boyce Code Normal FormA special form of third normal form (3NF) in which every determinates I s a

    candidate key. A table that is in BCNF must be in 3NF. When a table contains onlyone candidate key, the 3NF and the BCNF are equivalent.4NF:

    A table is in fourth normal form (4NF) when it is in 3NF and has no multiple

    sets of multivalued dependencies.

    The 4NF has following two rules:

  • 7/31/2019 DBMS Solution Paper 2009

    3/4

    - All attributes must be dependent on the primary key, but they must beindependent of each other.

    - No row may contain two or more multivalued facts about an entity.(B) Answer the following (any one) 7

    1Explain Distributed Database and disributed processing with appropriatediagrams.

    Answer:Distributed Database

    A logically related database that is stored over two or more physicallyindependent sites.Disributed processing

    The activity of sharing (dividing) the logical processing of a database overtwo or more sites connected by a network.

    2 Discuss the components of DDBMS with a diagram.Answer:Components of DDBMS

    Computer workstations that from the work system. The distributeddatabase system must be independent of the computer system hardware.

    Network hardware and software components that reside in eachworkstation. The network components allow all sites to interact and exchangedata.

    Communication media that carry the data from one workstation toanother. The DDBMS must be communications-media-independent; that is, itmust be able to support several types of communications media.

    The transaction processor (TP), which is the software component, found ineach computer that requests data. The transaction processor receives andprocesses the applications data requests. The TP is also known as the applicationprocessor (AP) or the transaction manager (TM).

    The data processor (DP), which is the software components residing oneach computer that stores and retrieves data located at the site. The DP is alsoknown as the data manger (DM), a data processor may even be a centralizedDBMS.

    4 Answer the following. 14(A) Answer any one of the following. 72 Discuss Hierarchical and Relational Data Models.

    Answer:Hierarchical Data Models

    The hierarchical model was developed in 1960 to manage large amounts ofdata for complex manufacturing project such as the Apollo rocket that landed onthe moon in1969. Its basic logical structure is represented by an upside downtree.

    The hierarchical structure contains levels or segments. A segment is theequivalent of a file systems record type. Within the hierarchy the top layer (the

    root) is perceived as the parent of the segment directly beneath it.Relational Data Models

    The relational model was introduced by E.F.Codd in 1970 in his landmarkpaper A relational model of data for large shared Databanks. The relationalmodel represented a major breakthrough for both users and designers. To use ananalogy, the relational model produced an automatic transmission database toreplace the standard transmission database that preceded it. It conceptualsimplicity set the stage for a genuine database revolution.

    The relational data model is implemented through a very sophisticatedrelational database management system (RDBMS).

    5 Answer the following (Any two). 14

    1What is Transaction? List and discuss ACID properties of a Transaction. Define

    Transaction Log and Whatis its function.Answer:Transaction

  • 7/31/2019 DBMS Solution Paper 2009

    4/4

    In a database terms, a transaction is any action that reads from and / orwrites to a database.ACID properties of a TransactionAtomicity

    Atomicity requires that all operations of a transaction be completed; if not,the transaction is aborted. If a transaction T1 has four SQL requests, all four

    requests, must be successfully completed, other wise, the entire transaction isaborted.Consistency:

    Consistency indicates the permanence of the databases consistent state.When a transaction is completed, the database reaches a consistent state.Isolation:

    Isolation means that the data used during the execution of a transactioncannot be used by a second transaction until the first one is completed.

    This property is particularly useful in multiuser database environmentsbecause several different users can access and update the database at the sametime.Durability:

    Durability ensures that once transaction changes are done, they cannot beundone or lost, even in the event of a system failure.Serializability:

    Serializabilty ensures that the concurrent execution of several transactionsyields consistent results.

    This property is important in multiuser and distributed database, wheremultiple transactions are likely to be executed concurrently. Naturally, if only asingle transaction is executed, serializability is not an issue.

    2 Explain types of locks in detail.Database level lock:

    A type of lock that restricts database access to only the owner of the lock.It allows only one user at a time to access the database. Successful for batchprocesses, but unsuitable for online multiuser DBMSs.Page level lock:

    In this type of lock, the database management system will lock an entiredisk page, or section of a disk. A disk page can contain data for one or more rowsand from one or more tables.Table level lock:

    A locking schema that allows only one transaction at a time to access atable. A table level lock locks an entire table, preventing access to any row bytransaction T2 while transaction T1 is using the table.Row level lock:

    A comparatively less restrictive database .