p4 solution

Upload: thexplanet

Post on 14-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 P4 Solution

    1/11

    University of Mumbai

    TYBSc Computer Science Paper IVMarch 2012

    Solution Set

    1. Write short notes (Attempt any Four) (20)

    (a) Lock Manager

    Marks Distrib-5Imp Points:The part of DBMSkeeps track of locks issuedMaintains a lock tableHash table with data object( page, record etc.) identifieras key. Contains type of lock

    Maintain transaction tablecontains a pointer to list of locks held by transaction.According to the 2PL manages lock request for shared lock or exclusive lock. If

    not possible grant lock add request in queue.

    Suggestions

    (b) CASE statement in PL/SQL

    Marks Distrib-5

    Imp Points:Simple Case Search Case

    Case expr Case

    When expe-val-1 then When Boolean_expe-val-1 then

    Statement; ; Statement; ;

    When expe-val-2 then When Boolena_expe-val-2 then

    Statement; ; Statement; ;

    Else Else

    Statement; ; Statement; ;

    End case; End case;

    i.e Declare

    Tr_code number;Begin

    .

    Case Tr_code

    when 1 then

    insert .

    When 2 then

    Update.

    Else

    DBMS_OUTPUT.

    End case;

    End;Suggestions

    (c) Responsibilities of Project Manager

    Marks Distrib-5

    Imp Points: Acts as a controllerestablishes the team & done followingactivites:

    Internal : Identify project tasks & build a work breakdown structure- Develop the

    project schedule- recruit & train team members- Assign task to members-Coordinate activites of team & subteam members- Monitor & control deliverables

    & milestones of project- verify qulaity of project

    External: Reports the status & progress of project.Establish good working

  • 7/30/2019 P4 Solution

    2/11

    relationship with end usersWork directly with client- identify resorcess needed& arranges those.

    Suggestions

    (d) Phases in Unified Process

    Marks Distrib-5

    Imp Points:Inspectiondeals with approximate version of system- produce rough estimateElaborate- refine version-finalize scope, design & implement core activities-

    resolve high risks prepare cost estimate & schedule

    ConstructionIteratively implement the remaining lower risk predicates &easier elements- prepare for deployment

    Translationcomplete beta test-& deployment so user can have working system

    Suggestions

    (e) Stages /phases in static testing

    Marks Distrib-5

    Imp Points:1. Control flow analysischecks loops with multiple exit or entry points &unreachable code

    2. Data use analysischecks Un-initialized variables, variables written twicewithout an intervening assignment & variables which ar declared but never used.

    3. Interface analysis- checks Consistency of routine and procedure declaration &

    their use

    4. Information flow analysis- checks Dependencies of output variables,information for code inspection or review

    5. Path analysischecks path through the program & sets out the statementsexecuted in that path.

    Suggestions

    (f) Closure set of FD

    The set of all FDs implied by a given set of F of FDs is called the closure of F,denoted as F

    +.- to infer closure of FDs following rules (Armstrongs Axioms )

    can be applied:

    Reflexivityif X Y , then XYAugmentationif X Y, then XZYZ for any ZTransitivityif Xy and YZ, then XZSuggestions

    2. Attempt any Four (20)(a) Explain the concept of transaction & schedule with example.

    Marks Distrib-5

    Imp Points: Transaction- a series of actions(Read, Write of database objects) i.e.RT(O) , WT(O)in addition to these actions each transaction must specify finalaction as commit or abort.

    Schedule: - list of actions from a set of transactions and order in which twoactions of a transaction T appear in a schedule i.e represents execution sequence

    Ex. T1 T2

    R(A)

    W(A)

  • 7/30/2019 P4 Solution

    3/11

    R(B)W(B)

    Commit

    R(C)W(C)

    A schedule that contains abort or commit for each transaction is called completeSchedule.

    Suggestions

    (b) State the structures associated with recovery. Explain any one of them.

    Marks Distrib-5 2+3

    Imp Points: The LOGalso called as trail/Journal - History of actions executed

    by the DBMS.Physically it is filedurability can be aceived by maintain morecopies on different disks.Log tail(recent portion) kept in memory- every recordis given unique id called log sequence number(LSN).pageLSN is used inrecovery.log record is written for actions like updating a page, commit, abort,

    end, undo of an update. Fields of log record: prevLSN, transID, typeTransaction Table - entry for each active transaction- contains trans. Id , status

    & lastLSN(LSN of most recent log record for the transaction.Status : progress,commited, aborted.

    Dirty page tableoneentry for each dirty page in the buffer pool- i.e each page

    with changes not yet reflected on disk.- contain recLSN(LSN of the first log

    record that caused the page to become dirty.During normal operation tables are maintained by transactuion manager & buffer

    manager

    Suggestions

    (c) How to prevent Dead locks?Marks Distrib-5

    Imp Points:It can be done by giving priority to each transaction & ensuring that lower prioritytransactions are not allowed to wait for higher priority transactions. One way to

    assign priority is to give timestamp to each transaction when it starts. The lower

    the timestamp higher the priority.

    Suppose Ti & Tj are the two transactions holds conflicting lock, manager can usefollowing polcies:

    Wait-die: if Ti has higher prio, it is allowed to wait, otherwise it is aborted.- here

    lower prio transaction never waits for higher prio transaction.

    Wound-wait: if Ti has higher prio , abort Tj; otherwise Ti waitshigher priotransaction never wait for lower prio transactionConservative 2PL can prevent deadlock

    Suggestions

    (d) Discuss the anomalies associated with interleaved transactions.

    Marks Distrib-5(1+4) if stated 3 -1 mark & even if 2 are explain (2+2)

    Imp Points: Conflictstwo actions on same data object-

    The three anomalies :Reading uncommitted data (WR Conflict): Dirty ReadTran 1 reads object Awhich modified by another trans 2 but not committed yet.

    Unrepeatable Read(RW Conflict) : never arises in serial execution of 2 transaction

  • 7/30/2019 P4 Solution

    4/11

    i.e. trans 1 reads object A, Trans 2 also reads A & writes modified Object A.Again Tran 1 try to read A which get different result.

    Overwriting uncommitted data(WW Conflict): trans 1 modifies the object A

    which is already modified by trans 2- lost update problem.

    Suggestions(e) Write in brief about Analysis phase of ARIES.

    Marks Distrib-5

    Imp Points:Tasks performed by Analysis phase:

    1. Determines the point in the log at which to start the Redo pass.2. Determines pages in the buffer pool that were dirty at the time of the crash3. Identifies transactions that were active at the time of the crash & must be

    undone.

    Analysis begins by examining the most recent begin_checkpoint log record &

    initializing the dirty page table & transaction table to the copies of those

    structures in the next end_checkpoint rcord .Then analysis scans the log in forward direction until it reaches the end of the

    log:- If an end log record for trans T is encounterd , T is removed from thetransaction table as it not active.if log record other than an end record isfound an entry is added to the transaction table if it is not here. entries fortransaction T is modifiedthe lastLSN field is set to the LSN of this log rec-if the log rec is commit rec the status is set to C, otherwixe it is set toU(undone)

    At the end of analysis the transaction table contains a accurate list of all

    transactions that were active at the time of the crash.

    Suggestions(f) What is the need of decomposition? Explain loss-less property of decomposition.

    Marks Distrib-5

    Imp Points:Decomposition consists of replacing the relation(R) schema by two or more

    relation schemas where each contain a subset of the attributes of original

    relation(R). This is basically needed to reduce data redundancy (normalization).

    But still we need to store info in any given instance of relation R by storingProjections of the instance

    LosslessJoin Decomposition :- Decom of R into two schema with attribute setX & Y is lossless with respect to F, if for every instance r of R that satisfies the

    dependencies in F,X( r ) ,y( r ) = r. i.e. recover the original relation fromthe decomposed.That is If Relation R is decomposed into R1 & R2 through loss less-join decom. &further R1 is decomposed into R11 & R12 then by joining R11 & R12 one can get

    R1 & again from R1 , R2 one can get R.

    Suggestions

    3. Attempt any Four (20)

    (a) What is Sequence? How to use sequences explain with example.

    Marks Distrib-5

  • 7/30/2019 P4 Solution

    5/11

    Imp Points:Sequence: that generate series of numeric values.value can be upto 38 digit-can be defined to generate in asc/desc order- allows intervals between numbers-

    allows caching of numbers in memory for faster access. It is independent object ,can be used with any table.

    With following command sequence can be created.Create sequence [ Increment by n] Maxval / Nomaxvalue

    Minval/Nominvalue Cycle/Nocycle cache/nocache Order/noorder]Once the sequence is created we can use it while inserting data

    i.e insert into table vales( seq.nextval,..);Nextval Currval are pseudo columnsnextval gives next value, currval givescurrent value of the sequence.Sequence does not intialise until nextval is called.Suggestions

    (b) Assume Book table consisting of columns bookno, name, no-of_copies & price.

    Write a PL/SQL code to accept bookno , copies & transaction code( A for add &

    R for remove). Display current stock & cost (copies*price)of specified book &

    then update table according to transaction code.Marks Distrib-5

    Imp Points:Declare

    Bno number / book.bookno%type;

    Tcode char(1);

    Bkcopy number;Cost number;

    Pr book.price%type;

    Cp book.no_of_copies%type;Begin

    Bno:=&bno;Tcode:=&tcode

    Bkcopy:=&bkcopySelect no_of_copies,price into cp, pr where bookno=bno;

    If tcode=A thenCp:=cp+bkcopy;

    Else

    Cp:=cp-bkcopy;

    End if;

    Cost:=cp*pr;Dbms_outpur.put_line(Stock :||cp||Cost = ||cost);

    Update book set no_of_copies=cp;Commit;Exception

    When no_data_found then

    Dbms_outpur.put_line( No such book exist);End;

    Suggestions

  • 7/30/2019 P4 Solution

    6/11

    (c) What is system catalog? Explain its structure.

    Marks Distrib-5

    Imp Points:The collection of files corresponding to users tables & indexes represents the datain the database. A RDMS maintains info about every table & index that it

    contains. This info itself stored in a collection of special tables called the catalogtables. It contains

    For each Table:- name, the file name & the file structure of the file in whih it isstoredthe attribute name & type of each attributethe index name of each indexon the tablethe integrity constraints on the tableFor each index : the index name & the structure of the indexthe search keyFor each view: the view name & its definition.In addition it also stores : Cardinality the no of tuples.

    Size : no of pages

    Index cardinality , Index sizeEx. Attribute catalog called attrinbute_Cat contains info about table book

    Attribute_name Rel_name type positionBookno Book integer 1Book_name Book string 2

    No-ofcopies book integer 3 and so on

    Suggestions

    (d) With example explain query evaluation plan.

    Marks Distrib-5

    Imp Points:Query evaluation paln consist of extended relational algebra tree, with additional

    annotations at each node indicating th access methods to use for each table & theimplementation method to use for each relational operator.

    i.e Query is Select B.bname from issued I , book B where B.bno=I.bno andb.bno=101 and I.idate

  • 7/30/2019 P4 Solution

    7/11

    Indexing- if selection or join condition is specified, use an index to examine justthe tuples that satisfy the condition.

    Iteration- examine all tuples one after other, If we need only a few fields & there

    is an index whose key contains all these fields, instead of examining data tuples,we can scan all index data entries

    Partitioningby portioning on a sort key , we can often decompose an operationinto a less expensive collection of operationson partitions. Sorting & hashing aretwo commonly use portioning techniques.

    Suggestions

    (f) What is cursor? Explain cursor attributes.

    Marks Distrib-5

    Imp Points:Cursor:- an private area for internal processing - to execute SQL statement- Datastore in cursor called as active data set.

    Cursor attributes:-

    %found

    %notfound)%rowtype;

    Ex:declare cursor c1 is (select roll,name from student);

    no c1%rowtype;begin

    open c1;fetch c1 into no;

    while c1%found loop

    Suggestions

    4. Attempt any Four (20)

    (a) Which activities are involved in project management process? How these

    activities are grouped?

    Marks Distrib-5

    Imp Points:

    The Project mgm process specifies all activities that need to be done by the project

    mgm. to ensure that cost & quality objectives are met. The activities can begrouped broadly into 3 phases as follows:

    1. Planning : develop plan for SW development which successfully met allobjectives.produce before development activity begins & is updated asdevelopment proceeds.

    2. Monitoring & Control: phase of longest duration- As cost, schedule &quality are main driving forces, most of the activity revolves around

    monitoring factors that affect these- monitoring potential risk is anotheractivity- this requires proper info about project

    3. termination Analysis: start when development process gets over- alsoknown as Postmortem analysispurpose is to provide info aboutdevelopment process & learn more about improvement.

    Suggestions

    (b) State the basic steps in COCOMO. Suppose Inventory module for medical shop

  • 7/30/2019 P4 Solution

    8/11

    has to be designed. The requirements indicate the system is small & size estimatedfor different sub-modules is as follows:

    Data Entry & update 1.2 KLOC, Data access 1.0 KLOC, Reports 0.8KLOC

    Other cost drivers are as follows :Complexity Low 0.88, Storage very high 1.21 Experience high 0.91.

    Calculate effort adjustment factor, initial effort estimate & adjusted effortestimate.

    Marks Distrib-5

    Imp Points:

    Basic steps:

    1. Obtain an initial stimate of the development effort from the estimateof thethousands of delivered lines of source code(KLOC)

    2. Determine a set of 15 mulitiplying factors from different attributes of theproject

    3. Adjust the effort estimate by multilplying the initital estimate with all themultiplying factor.Problem solution: system is organic : a= 3.2 & b=1.05

    Estimate E = EAF * Ei

    Effort adjustment factor EAF is calculated by multiplying ratings of various

    cost drivers.

    Initial estimate Ei=a * (KLOC)b

    KLOC= 1.2+1.0+0.8 = 3

    Ei = 3.2 * (3.0)1.05

    = 10.14PM

    EAF = 0.88*1.21*0.91 = 0.97E= 0.97*10.14= 9.82 PM

    Suggestions

    (c) Which basic functionalities are needed from Configuration management process?Marks Distrib-5

    Imp Points:1. Give latest version of a program. Any modification should be carried out

    in latest copy.

    2. Undo a change or revert back to a specified version- a change is made butlater becomes necessary to cancel changes . CM process should allow this

    smooth operation.

    3. Prevent unauthorized changes or deletions- A programmer may decide tochange some code just to check any adverse side effect.- CM process mustprevent any unapproved change.

    4.

    Gather all sources, documents & other info for the current system. Allsources & related files are required for product release. CM process shouldprovide this.

    Suggestions

    (d) Explain principles of agile development.

    Marks Distrib-5

    Imp Points:1. Develop software as your primary goal.2. Enable the next effort as your secondary goal3. Minimize your modeling activity- simple

  • 7/30/2019 P4 Solution

    9/11

    4. Embrace change & change incrementally5. Model with a purpose6. Build multiple models7. build high quality models a get feedback rapidly8. focus on content rather than representation9.

    Learn from each other with open communication10.Know your models & how to use them

    11.adapt to specific project needs.Suggestions

    (e) What is the use of charts like Gantt & PERT/CPM

    Marks Distrib-5

    Imp Points: A PERT/CPM is a diagram of all tasks identified in WBS, indicatingsequence of dependencies where rectangle represents a single task or activity

    within which contains name of the task, unique identifier, duration, beginning &

    end date. The connecting arrows indicate dependencies ,where some task may go

    parallely which helps in staffing & work balancing finally help is finding CrititcalPath (longest path covering all activitiesd.

    Gant Chart helps in monitoring project progress- PERT/CPM activities can beviewed on spread out calendar.x-axis shows dates & on y axis activities. Whereone can have PERT schedule & then actual progress.

    Suggestions

    (f) State metrics from CK Metrics suite. Explain two of them.

    Marks Distrib-5

    Imp Points:CK (chindamber & Kemerer) is class oriented metrics suite

    Weighted methods per class(WMC): Assume n methods of compxity c1,c2,cn are define for class C. WMC = ci for i= 1 to nDepth of the inheritance tree(DIT) it maximum length from the noce to therootof the tree. A deep class heirachy (large DIT) leads to greater design

    complexity , but it also imply that many methods may be reused

    Number of children(NOC): As number of children grows , reuse increases- butas NOC increases , abstraction represented by te parent can be diluted, the amount

    of testing (to execute each child in its operational context) also increases.

    Coupling between Object classes(CBO): The CRC model may be used to

    determine CBO. it is number of collaborations listed for a class on its CRCindex cardconsistent with guideline to reduce coupling.

    Response for a class(RFC): it is a set of methods that can potentially beexecuted in response to a message received by an object of that class.

    Lack of cohesion in methods(LCOM): It is number of methods that access oneor more same attributes(instance variables)- If no method access same attribute

    then LCOM is zero- Suppose out of 6 methods four methods have one or more

    attributes in common then LCOM=4.

    Suggestions

    5. Attempt any Four (20)

    (a) State the objectives of software testing. Explain any two.

  • 7/30/2019 P4 Solution

    10/11

    Marks Distrib-5

    Imp Points: Major objectives:-

    Verification- confirms that software meets its technical specifications. Checks

    that output of each activity meet the requirements 4 levels Component testing,Integration testing system testing & acceptance testing.

    Validation confirms that software meets business requirement- Testing ofdevice software functionality in simulated use environment, & user site testing arepart of components of an overall design validation

    Defect prevention: defect is an variance between the expected result and actual

    result.- early defect detection & prevention is key process in development- errors

    may increase the cost of software.

    Quality improvement: As people are becoming more dependent of software,quality is imp. factor.- Quality means conformance to the specified design

    requirement. The main goal of software eng. Is to produce high quality software.

    Reliability: Reliability can be defined as the probability of failure free operationsfor a specified period of time in a specific environment.

    Suggestions(b) Explain following types of testing: Unit Testing, System Testing.

    Marks Distrib-5

    Imp Points:Unit Testing: use to test particular function or module in the code.micro scaletesting- The developer carries out unit testing in order to check if the particular

    module or unit of code is working correctly.comes at basic level as it done as &when the unit is developed or new function is added.requires detail knowledgeof program logic & code, it is done by programmer & not by teseter.

    System testing: is more robust version of the external test, & can be known as

    alpha test.concentrates on testing the complete system with avariety of

    techniques & methods.- It comes in picture after unit& integration testing.- theplatform must be as close to production use in the customers environment, including hardware setup, database siz & complexity.generally combined withacceptance testing/integration testing

    Suggestions

    (c) What are the elements of Software Quality Assurance?

    Marks Distrib-5

    Imp Points:Standards: IEEE,ISO & ther std. organizations produce broad array of software

    engineering std. The job of SQA is to ensure that stds have been adopted & works

    with product.

    Review & audits : Technical reviews are a quality control activity performed bysoftware eng. purpose is to uncover errorsTesting: Testing is quality control functionError/defect collection and analysis:

    Change management

    EducationVendor management

    Security management

    Safety

    Risk management

    Suggestions

  • 7/30/2019 P4 Solution

    11/11

    (d) What is Black box testing? Discuss the knowledge sources for Black box testing.

    Marks Distrib-5

    Imp Points:It can be considered testing with respect to the specifications & no programknowledge or internal working is necessary. Tester is unaware about coding.

    Knowledge sources:Requirement Document - Specifications - Domain Knowledge -

    Defect Analysis DataTechnique use the specifications or the required behaviour of the software as a

    starting point to design test cases. The above knowledge sources help in designing

    proper test cases. Tester comes to know functional properties & expected output

    as well legal input from these sources.

    Suggestions

    (e) Considering following function code draw a flow graph , Find basic paths &

    calculate cyclomatic complexity.

    Public void update(){ if( upd=Yes)Update record()Exit()

    Else

    If ( upd = Reset)Clear()

    Else

    Exit()

    }

    Marks Distrib-5

    Imp Points:Basic paths :

    1-2

    N=8 e= 9 p =1

    e-n+2p = 9-8+2*1 = 1+2 = 3

    Suggestions

    (f) List the issues/challenges in software testing. Suggest the solution to meet these

    challenges.

    Marks Distrib-5

    Imp Points:These are the problems in testing for which clear cut solution does not exist-

    Measurement of testing progress - Voluminous test data -Late deployment-Testability of requirement - Misunderstanding the role of testing - Poor planning

    of the testing - Appointing wrong person as tester - Poor testing methodologyIncomplete testing

    Suggestions

    1

    2

    6

    4

    5

    7

    3

    8