Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Learning Objectives Learning Objectives In this module we will learn How to use structured English to precisely specify processes The terminology used in structured English Terminology of decision tables and how it is used to specify complex logic How to detect errors in decision table specifications Terminology and use of decision trees Comparison of structured English, decision tables and decision trees V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/1 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Motivation Motivation Before designing a system an analyst must clearly understand the logic to be followed by each process block in a DFD An analyst’s understanding must be cross checked with the user of the information system. A notation is thus needed to specify process block in detail which can be understood by a user. Notation used must be appropriate for the type of the application to be modeled. Different notations are needed to represent repetition structures,complex decision situation and situations where sequencing of testing of conditions is important For complex logical procedures a notation is needed which can also be used to detect logical errors in the specifications. A tabular structure for representing logic can be used as a communication tool and can be automatically converted to a program. V. Rajaraman/IISc, Bangalore Indian Institute of Science Bangalore //V1/July 04/1 Process Specification • Once a DFD is obtained the next step is to precisely specify the process. • Structured English, Decision tables and Decision Trees are used to describe process. • Decision tables are used when the process is logically complex involving large number of conditions and alternate solutions • Decision Trees are used when conditions to be tested must follow a strict time sequence. V. Rajaraman M6/LU1/V1/2004 1 Structured English • Structured English is similar to a programming language such as Pascal • It does not have strict syntax rules as programming language • Intention is to give precise description of a process • The structured English description should be understandable to the user V. Rajaraman M6/LU1/V1/2004 2 Structured English if customer pays advance then Give 5% Discount else if purchase amount >=10,000 then if the customer is a regular customer then Give 5% Discount else No Discount end if else No Discount end if end if V. Rajaraman M6/LU1/V1/2004 3 Decision Table-example Same structured English procedure given as decision table CONDITIONS Advance payment made Purchase amt >=10,000 Regular Customer? RULE1 Y - RULE2 N Y Y RULE3 N Y N RULE4 N N - ACTIONS Give 5% Discount Give No Discount V. Rajaraman X - X - M6/LU1/V1/2004 X X 4 Decision Table-explanation • Conditions are questions to be asked • ‘Y’ is yes,’N’ is no & ‘-’ is irrelevant • A ‘X’ against the action says the action must be taken • A ‘-’ against the action says the action need not be taken Rule 2 in decision table DISCOUNT states: if no advance payment and purchase amount >=10000 and regular customer then give 5% discount V. Rajaraman M6/LU1/V1/2004 5 Structured English • Imperative sentences- Actions to be performed should be precise and quantified Good Example: Give discount of 20% Bad Example: Give substantial discount V. Rajaraman M6/LU1/V1/2004 6 Structure English (Contd.) • Operators -Arithmetic : +, -, /, * Relational : >, >=, <, <=, =, != Logical : and, or, not Keywords : if, then, else, repeat, until, while, do, case, until, while, do, case, for, search, retrieve, read, write • Delimiters – {, }, end, end if, end for V. Rajaraman M6/LU1/V1/2004 7 Decision Tree-example The structured English procedure given in 6.1.3 is expressed as a Decision tree below Give 5% Discount Y Y C1 C3 N Y C2 Give 5% Discount N No Discount N No Discount C1: Advance payment made C2: Purchase amount >=10,000 C3: Regular Customer V. Rajaraman M6/LU1/V1/2004 Y = Yes N = No 8 Structured English-decision Structures If condition then { Group of statements } else { Group of statements } end if Example: if(balance in account >= min.balance) then honor request else reject request end if V. Rajaraman M6/LU1/V1/2004 9 Structured English-case Statement Case (variable) Variable = P: { statements for alternative P} Variable = Q: { statements for alternative Q} Variable = R: { statements for alternative R} None of the above: { statements for default case} end case Example : Case(product code) product code =1 : discount= 5% product code =2 : discount =7% None of the above : discount=0 end case V. Rajaraman M6/LU1/V1/2004 10 STRUCTURED ENGLISH-REPETITION STRUCTURE for index = initial to final do { statements in loop } end for Example : Total =0 for subject =1 to subject =5 do total marks=total marks +marks(subject) write roll no,total marks end for V. Rajaraman M6/LU1/V1/2004 11 STRUCTURED ENGLISH-WHILE LOOP while condition do { statements in loop } end while Example : while there are student records left to do read student record compute total marks find class write total marks, class, roll no end while V. Rajaraman M6/LU1/V1/2004 12 Example Update inventory file for each item accepted record do { search inventory file using item code if successful then { update retrieved inventory record; write updated record in inventory file using accepted record} else { create new record in inventory file; enter accepted record in inventory file} end if end for DECISION TABLE-MOTIVATION • A procedural language tells how data is processed • Structured English is procedural • Most managers and users are not concerned how data is processedthey want to know what rules are used to process data. • Specification of what a system does is non-procedural. • Decision Tables are non-procedural specification of rules used in processing data V. Rajaraman M6/LU2/V1/2004 1 ADVANTAGES OF DECISION TABLE •Easy to understand by non-computer literate users and managers •Good documentation of rules used in data processing. •Simple representation of complex decision rules . V. Rajaraman M6/LU2/V1/2004 2 ADVANTAGES OF DECISION TABLE (Contd.) • Tabular representation allows systematic validation of specification detection of redundancy,incompleteness & inconsistency of rules • Algorithms exist to automatically convert decision tables to equivalent computer programs. • Allows systematic creation of test data V. Rajaraman M6/LU2/V1/2004 3 METHOD OF OBTAINING DECISION TABLE FROM WORD STATEMENT OF RULES EXAMPLE A bank uses the following rules to classify new accounts If depositor's age is 21 or above and if the deposit is Rs 100 or more, classify the account type as A If the depositor is under 21 and the deposit is Rs 100 or more, classify it as type B If the depositor is 21 or over and deposit is below Rs 100 classify it as C If the depositor is under 21 and deposit is below Rs 100 do-not open account Identify Conditions: Age >= 21 Cl Deposits >= Rs 100: C2 Identify Actions : Classify account as A, B or C Do not open account V. Rajaraman M6/LU2/V1/2004 4 DECISION TABLE FROM WORD STATEMENT Condition Stub CODITIONS Rule 1 Rule 2 Rule 3 Rule 4 C1 : Age >= 21 Y N Y N C2: Deposit >=100 Y Y N N A1: Classify as A X - - - A2: Classify as B - X - - A3: Classify as C - - X - - - - X ACTIONS A4: Do not open Account Action Stub V. Rajaraman M6/LU2/V1/2004 5 DECISION TABLE NOTATION EXPLAINED CONDITION STUB CONDITION ENTRIES ACTION STUB ACTION ENTRIES RULE • 4 Quadrants-demarcated by two double lines •CONDITION STUB LISTS ALL CONDITIONS TO BE CHECKED •ACTION STUB LISTS ALL ACTIONS TO BE CARRIED OUT •LIMITED ENTRY DECISION TABLE:ENTRIES ARE Y or N or -.Y-YES,NNO,-IRRELEVANT(DON’T CARE) •X against action states it is to be carried out. •-against action states it is to be ignored. •Entries on a vertical column specifies a rule V. Rajaraman M6/LU2/V1/2004 6 DECISION TABLE NOTATION -CONTD • ORDER OF LISTING CONDITIONS IRRELEVANT i.e. CONDITIONS MAY BE CHECKED IN ANY ORDER • ORDER OF LISTING ACTIONS IMPORTANT • ACTIONS LISTED FIRST CARRIED OUT FIRST SEQUENTIAL EXECUTION OF ACTIONS • RULES MAY BE LISTED IN ANY ORDER V. Rajaraman M6/LU2/V1/2004 7 INTERPRETING DECISION TABLE-ELSE RULE C1: Is applicant sponsored C2: Does he have min qualification C3: Is fee paid? R1 R2 Y Y Y Y Y N A1: Admit letter A2: Provisional Admit letter A3: Regret letter X - - - X - - - X V. Rajaraman M6/LU2/V1/2004 ELSE 8 INTERPRETING DECISION TABLE-ELSE RULE (Contd.) • Interpretation • R1: If applicant sponsored and he has minimum qualifications and his fee is paid –Send Admit letter • R2: If applicant sponsored and has minimum qualifications and his fee not paid send provisional admit letter • ELSE: In all cases send regret letter.The else rule makes a decision table complete V. Rajaraman M6/LU2/V1/2004 9 DECISION TABLE FOR SHIPPING RULES C1: Qty ordered <= Quantity in stock? C2: (Qty in stock-Qty ordered) <=reorder level C3: Is the partial shipment ok? A1:Qty shipped=Qty ordered A2:Qty shipped=Qty in stock A3:Qty shipped=0 A4:Qty in stock=0 A5:Back order=qty orderedqty shipped A6:Initiative reorder procedure A7: Qty in stockÅQty in stock-Qty shipped V. Rajaraman R1 R2 R3 R4 Y Y N N N Y - - - - Y N X X - - - - X X X - - - X X - X X X X X - - M6/LU2/V1/2004 10 EXTENDED ENTRY DECISION TABLE Condition Entries not necessarily Y or N Action entries not necessarily X or Extended Entry Decision Tables(EEDT) more concise EEDT can always be expanded to LEDT Example R1 R2 R3 R4 R5 R6 C1 : Product code 1 1 1 1 1 2 C2 : Customer code A B A B C - C3 : Order amount Discount = V. Rajaraman <=500 <=500 5% 7.5% >500 7.5% M6/LU2/V1/2004 >500 10% - - 6% 5% 11 MIXED ENTRY DECISION TABLE Can mix up Yes, No answers with codes Rl R2 R3 R4 R5 Cl : Product code = 1? C2: Customer code = C3: Order amount < 500? A Y Y B Y Y A N Y B N Y C - Discount = 5% 7 5% 7 5% 10% 6% R6 N 5% Choice of LEDT, EEDT, MEDT depends on ease of communication with user, software available to translate DTs to programs, ease of checking etc. V. Rajaraman M6/LU2/V1/2004 12 LINKED DECISION TABLE Decision table 2 Decision table 1 Salary point=6 Conduct OK? Diligence OK? Efficiency OK? N Y Y Y e l s e Go to table 2 No promotion X - X V. Rajaraman Salary point>2 1 yr as class 1 officer Departmental test Passed? Advance to next salary point No promotion Go to Table3 M6/LU2/V1/2004 N Y N N N - Y - Y - N - X - X X - - - X - 13 LINKED DECISION TABLE Decision table3 Complete departmental Course 1 yr since last increment Advance to next salary point No promotion V. Rajaraman Y else 1.Observe that one can branch between tables Y X - - X 2. Whenever complex rules are given it is a good idea to break them up into manageable parts M6/LU2/V1/2004 14 LOGICAL CORRECTNESS OF DECISION TABLE Consider decision table DTI: Cl: x>60 C2:x<40 Rl Y - R2 . Y Al A2 : X - X V. Rajaraman We can expand decision table by replacing each –by Y & N M6/LU3/V1/2004 1 LOGICAL CORRECTNESS OF DECISION TABLE (Contd.) DT2: R11 R12 R21 R22 N Y Y Y Cl: x>60 C2:x<40 Y Y Y N Al A2 : X - X - X X A rule which has no – is an Elementary rule DT2 is an Elementary Rule Decision Table (ERDT) V. Rajaraman M6/LU3/V1/2004 2 LOGICAL CORRECTNESS OF DECISION TABLE (Contd.) • A decision table with 1 condition should have 2 elementary rules • Each elementary rule must be distinct • Each elementary rule must have distinct action • If a decision table with k conditions does not have 2k rules specified it is said to be incomplete For example : DT2 does not have the elementary rule C1:N, V. Rajaraman M6/LU3/V1/2004 3 LOGICAL CORRECTNESS OF DECISION TABLE (Contd.) • C2:N. • It is thus incomplete. • If the decision table has the same elementary rule occurring more than once it is said to have multiplicity of specifications • For Example:In DT2 The rule C1:Y,C2:Y occurs twice.Thus it has multiplicity of specification V. Rajaraman M6/LU3/V1/2004 4 LOGICAL CORRECTNESS OF DECISION TABLE (Contd.) • If action specified for multiple identical rules are different then it is called ambiguous specifications • DT2 has an ambiguity.Rules R11 and R21 are identical but have different actions • Ambiguity may be apparent or real V. Rajaraman M6/LU3/V1/2004 5 LOGICAL CORRECTNESS OF DECISION TABLE (Contd.) If an apparently ambiguous specification is real then it is a contradiction For example : If C1:(X > 60) = Y and C2:(X > 40) = Y then X = 70 will satisfy both inequalities. As two actions are specified for (Cl = Y, C2 = Y) and they are different the rule is really ambiguous and is called Contradictory Specification. V. Rajaraman M6/LU3/V1/2004 6 LOGICAL CORRECTNESS OF DECISION TABLE (Contd.) • If all 2k elementary rules are not present in a k condition decision table is said to be incomplete. •DT2 (PPT 6.3.1) is incomplete as rule C1:N, C2:N is missing •Rule C1=N, C2:=N is logically possible as C1=N is X<=60 and C2=N is X >= 40. A value of X = 50 will make C1=N,C2=N V. Rajaraman M6/LU3/V1/2004 7 LOGICAL CORRECTNESS OF DECISION TABLE (Contd.) • Thus DT2 has a real incomplete specification • A decision table which has no real ambiguities or real incompleteness is said to be logically correct • A decision table with logical errors should be corrected V. Rajaraman M6/LU3/V1/2004 8 USE OF KARNAUGH MAPS • KARNAUGH map abbreviated K-map is a 2 dimensional diagram with one square per elementary rule • The k-map of DT2 is C1 N C2 N ? Y A2 Y Al A1,A2 • If more than one action is in one square it is an ambiguous rule • If a square is empty it signifies incomplete specification V. Rajaraman M6/LU3/V1/2004 9 USE OF KARNAUGH MAPS Structured English procedure: If carbon content<0.7 then if Rockwell hardness>50 then if tensile strength>30000 then steel is grade 10 else steel is grade 9 end if else steel is grade 8 end if else steel is grade 7 end if V. Rajaraman M6/LU3/V1/2004 10 USE OF KARNAUGH MAPS Decision table-Grading steel C1:Carbon content <0.7 C2:Rockwell hardness>50 C3 tensile strength>30000 Grade V. Rajaraman Y Y Y N Y N N N Y Y N N N Y Y N Y N N N Y Y N Y 10 9 8 7 ? ? ? ? M6/LU3/V1/2004 11 KARNAUGH MAPS – GRADING STEEL C1 C2 NN C3 N 7 Y ? NY YY YN ? 9 8 ? 10 ? • The 3 conditions are independent • The decision table is thus incomplete • Observe that in the Structured English specifications the incompleteness is not obvious V. Rajaraman M6/LU3/V1/2004 12 DECISION TABLEARREARS MANAGEMENT R1 R2 R3 R4 R5 R6 Y N N - - - C1:Payment in current month >min.specified payment C2:Payment in current month>0 C3:Any payment in last 3 months C4: Actual arrears > 3(min. Specified payment per month) - Y - Y - N N Y N Y - Y N Y N Y A1 : Send letter A A2 : Send letter B A3 : Send letter C A4 : Send letter D A5 : Send letter E X - X - X - X - V. Rajaraman M6/LU3/V1/2004 X X 1 KARNAUGH MAP C1C2 C3C4 NN NN ? NY YY YN A3 A1 A1* NY A4 A2A4+ A1A4+ A1A4* YY A4 A2 A1 A1A4* YN A5 A3 A1 A1A5* K – Map for decision table V. Rajaraman M6/LU3/V1/2004 14 KARNAUGH MAP • C1 : x>m C2:x>0 C3:y>0 C4:z>3m • C3,C4 independent of C1,C2 m>0 C1,C2 dependent • C1: Y C2: Y x>m, x>0 possible • C1: Y C2: N x>m, x<=0 not logically possible • C1: N C2: Y x<=m,x>0 possible V. Rajaraman M6/LU3/V1/2004 15 KARNAUGH MAP • C1: N C2: N x<=m,x<=0 possible • Thus C1,C2,C3 C4:NNNN incomplete specification • BOXES MARKED * NOT LOGICALLY POSSIBLE • Rules C1 C2 C3 C 4 : NYNY and YYNY logical errors • Errors to be corrected after consulting users who formulated the rules V. Rajaraman M6/LU3/V1/2004 16 CORRECT DECISION TABLE • If users say that for rules C1C2C3C4:NYNY AND NYNY (marked with + in k-map) the action is A4 and for C1C2C3C4:NNNN also it is A4, the corrected map is C1C2 NN C3C4 NY YY NN A4 A3 A1 NY A4 A4 A4 YY A4 A2 A1 YN A5 A3 A1 V. Rajaraman YN M6/LU3/V1/2004 Impossible rules 17 CORRECTED DECISION TABLE C1 Y Y Y N N N N Y N N N N C2 Y Y Y Y Y Y Y Y N N N N C3 N Y Y Y N Y N N Y N N Y C4 N Y N Y N N Y Y Y Y N N A1 A1 A1 A2 A3 A3 A4 A4 A4 A5 Action V. Rajaraman M6/LU3/V1/2004 A4 A4 18 CORRECTED DECISION TABLE (Contd.) Question: Can the number of rules be reduced Answer : Yes, by combining rules with the same action Action A1 can be represented by the Boolean expression: C1C2C3C4 + C1C2C3C4 + C1C2C3C4 = C1C2C3C4 + C1C2C3 (C4+C4) = C1C2C3C4+C1C2C3 = C1C2C4 + C1C2C3 V. Rajaraman M6/LU3/V1/2004 19 REDUNDANCY ELIMINATION • Redundancy can be eliminated by systematically applying four identities of Boolean Algebra • These identities are A + A=1 l.A = A A+A=A 1+A=1 V. Rajaraman M6/LU4/V1/2004 1 REDUNDANCY ELIMINATION (Contd.) • K-map assists in identifying Boolean terms in which One or more variables can be eliminated • K-map is constructed in such a way that two boxes which are physically adjacent in it are also logically adjacent V. Rajaraman M6/LU4/V1/2004 2 KARNAUGH MAP REDUCTION C1 C2 NN NY YY YN C3 C4 NN NY C1 C2 NN C3 C4 A4 NN A4 NY YY YN A4=C1C2C3(C4+C4)=C1C2C3 V. Rajaraman A4 NY YY YN A4 A4 A4 YY YN A4=C3C4(C1C2+C1C2+C1C2+C1C2)=C3C4 M6/LU4/V1/2004 3 KARNAUGH MAP REDUCTION • • • • • Combining 2 adjacent boxes eliminates 1 variable Combining 4 adjacent boxes eliminates 2 variable Combining 8 adjacent boxes eliminates 3 variable First and last columns of k-map are logically adjacent First and last rows are also logically adjacent V. Rajaraman M6/LU4/V1/2004 4 KARNAUGH MAP REDUCTION C1C2 NN C3 C4 NY YY YN A1 A1 NN NY YY C1C2 NN NY YY YN C3 C4 A2 A2 A1 YN A1 V. Rajaraman A1 A1 A1 A2 A2 NY YY YN NY YY YN NN NN A1 C3 C4 C1C2 NN A3 A3 A3 A3 NY A2 A2 YY A2 A2 YN M6/LU4/V1/2004 5 KARNAUGH MAP REDUCTION (Contd.) A1=(C3C4+C3C4+C3C4+C3C4).(C1C2+C1C2)=C2(C3+C3)=C2 A2=(C1C2+C1C2)(C3C4+C3C4+C3C4+C3C4)=C2 A3=C1C2C3C4+C1C2C3C4+C1C2C3C4+C1C2C3C4 =C2C3C4(C1+C1)+C2C3C4(C1+C1) =C2C4(C3+C3)=C2C4 V. Rajaraman M6/LU4/V1/2004 6 REDUCING DECISION TABLES-USE OF K-MAP This is the K-map corresponding to DT of 6.3.12 C1C2 NN NY C3C4 NN A4 A3 YY A1 A4 A4 A4 YY A4 A2 A1 YN A5 A3 A1 NY V. Rajaraman YN Boxes marked X correspond to impossible rules. They can be used if they are useful in reducing rules Using k-map reduction rules we get A1 : C1C4+C1C3 A2 : C1C2C3C4 A3 : C1C2C4 A4 : C3C4+C2C3+C2C4 A5 : C2C3C4 M6/LU4/V1/2004 7 REDUCING DECISION TABLES REDUCED DECISION TABLE for DT of 6.3.12 C1: Payment in current month > min specified payment C2: Payment in current month>0 C3: Any payment in last 3 months C4: Actual arrears> 3(minimum specified payment per month) A: Send letter A B: Send letter B C: Send letter C D: Send letter D E: Send letter E V. Rajaraman Y - Y Y N N Y Y Y - N N N N - N Y N - Y Y - Y N X - X - M6/LU4/V1/2004 N - - - X - - X - - X X - - - - X - X 8 EXAMPLE-REDUCTION OF RULES IN WORD STATEMENT Rules : Insure Driver if following rules are satisfied 1. 2. 3. 4. 5. Drivers annual income > 20000 & is married male Drivers annual income > 20000 & is married and over 30 Drivers annual income <= 20000 & she is married female Driver is male over 30 Driver is married and age is not relevant Else do not insure V. Rajaraman M6/LU4/V1/2004 9 EXAMPLE-REDUCTION OF RULES IN WORD STATEMENT Conditions: • C1 : Annual income > 20000 • C2 : Male • C3 : Married • C4: Age > 30 Action: Insure or do not insure V. Rajaraman M6/LU4/V1/2004 10 DECISION TABLE FOR INSURANCE RULES Cl : Annual income> 20000 C2: Male C3: Married C4: Age > 30 Y Y Y - A1:Insure A2 :Do not insure Y Y Y X C1C2 NN C3C4 N N Y X - Y Y X - X - Y N X - E L S E X NY YY YN NN A1 NY V. Rajaraman A1 A1=C3+C2.C4 YY A1 A1 A1 A1 YN A1 A1 A1 A1 M6/LU4/V1/2004 11 REDUCED DECISION TABLE C2 : Male - Y C3 : Married Y - C4 : Age > 30 - Y X X - - - X Al : Insure A2 : Do not Insure ELSE Reduced rules : Insure if married or male over 30 Observe 5 rules simplified to 2 and 1 condition removed V. Rajaraman M6/LU4/V1/2004 12 DECISION TREES • Used when sequence of testing condition is important • It is more procedural compared to Decision trees. Book by II AC on 4/8/04 if available else book by II AC on 5/8/04.If both not available book by sleeper on 4/8/04 if available else book on 5/8/04 by sleeper.If none available return. V. Rajaraman M6/LU5/V1/2004 1 EXAMPLE – DECISION TREE TO BOOK TRAIN TICKET Book II AC Y C1 N Book II AC Y C2 Book sleeper Y N C3 Book ticket Y N C4 N Return V. Rajaraman M6/LU5/V1/2004 2 EXAMPLE – DECISION TREE TO BOOK TRAIN TICKET • • • • • C1: Is II AC ticket available on 4/8/04 C2: Is II AC ticket available on 5/8/04 C3: Is sleeper available on 4/8/04 C4: Is sleeper available on 5/8/04 Observe in the tree sequencing of conditions which is important in this example V. Rajaraman M6/LU5/V1/2004 3 DECISION TREES Decision trees are drawn left to right Circles used for conditions Conditions labelled and annotation below tree Conditions need not be binary For example: C1 >=60 GRADE A >=50 GRADE B >=40 GRADE C else GRADE F Sometimes Decision trees are more appropriate to explain to a user how decisions are taken V. Rajaraman M6/LU5/V1/2004 4 DECISION TREES Decision tree for decision table of 6.2.9 [Slide number 25] Discount=7.5% YES C3 A B C2 C Discount=5% YES Discount=10% NO Discount=7.5% C3 1 C1 NO Discount=6% 2 V. Rajaraman Discount=5% M6/LU5/V1/2004 5 DECISION TREES • C1 : PRODUCT CODE • C2 : CUSTOMER CODE • C3 : ORDER AMOUNT >500? • Observe that the 3 alternatives for connection C2 shown as three branching lines • SOME PEOPLE FIND DECISION TREE EASIER TO UNDERSTAND V. Rajaraman M6/LU5/V1/2004 6 DECISION TREES Decision tree equivalent of structured English procedure of 6.3.7 (SLIDE 37) is given below NO Grade 7 C1 Grade 8 YES C1 NO YES C1 Grade 9 NO YES Grade 10 V. Rajaraman M6/LU5/V1/2004 7 DECISION TREES • C1 : Carbon < 0.7 • C2 : Rockwell hardness > 50 • C3: Tensile strength > 3000 • Observe incompleteness evident in the equivalent Decision Table is not evident in the Decision tree • If the testing sequence is specified and is to be strictly followed the Decision tree is simple to understand. V. Rajaraman M6/LU5/V1/2004 8 COMPARISON OF STRUCTURED ENGLISH, DECISION TABLES AND DECISION TREES CRITERION FOR COMPARISON STRUCTURE D ENGLISH ISOLATING CONDITIONS & ACTIONS NOT GOOD SEQUENCING CONDITIONS BY PRIORITY GOOD CHECKING FOR COMPLETENES S, CONTRADICTIO N& AMBIGUITIES V. Rajaraman DECISION TABLES BEST NOT GOOD NOT GOOD BEST M6/LU5/V1/2004 DECISION TREES GOOD BEST GOOD 9 WHEN TO USE STRUCTURED ENGLISH, DECISION TABLES AND DECISION TREES Use Structured English if there are many loops and actions are complex Use Decision tables when there are a large number of conditions to check and logic is complex Use Decision trees when sequencing of conditions is important and if there are not many conditions to be tested V. Rajaraman M6/LU5/V1/2004 10 Prof. V.Rajaraman System Analysis and Design SUMMARY OF MODULE 6 1. Procedures are used to transform input data into processed results. 2. Procedure can be described in natural English. Such a description is often ambiguous due to impreciseness of natural English. Structured English attempts to describe verbal statements made in natural English more precisely. Precision is obtained by using ideas of logic and block structuring as in programming languages. Decision tables are more appropriate when a large number of conditions are to be checked in arriving at a set of actions. In structured English a number of key words are used for representing commonly used operations. Some important keywords are; search, retrieve, if, then, else, do, case, while, for. The important control structures used to describe a process are: Selection structure (using if then else or case), loop structure (using for, while and repeat unitl). 3. 4. 5. 6. 7. 8. Decision tables specify actions to be performed for each combination of results obtained by testing a set of conditions relevant in a problem. 9. Decision tables are used for communicating and documenting complex decision procedures. 10. In order to obtain a decision table from a word statement, we first isolate in each sentence a part which specifies the conditions and another part which specifies the actions to be performed, based on the result of testing the conditions. Conditions are then grouped in one or more table and the rules are formulated. 11. It is not advisable to have more than four or five conditions per decision table. If there are many conditions they are grouped and a set of tables are formulated and linked. 12. Limited Entry Decision Tables (LEDT) use only Y or N answers to conditions. 13. In Extended Entry Decision Tables (EEDT) conditions are formed by combining the statement in the condition stub with that in the condition entry part of the decision table. EEDTs are more concise. Indian Institute of Science Bangalore Prof. V.Rajaraman System Analysis and Design 14. A decision table is said to be complete if it has all possible distinct elementary rules. If any rule is missing it is incomplete. 15. If no values can be assigned to the condition variables leading to the missing rules then the decision table is said to be apparently incomplete. Otherwise it is really incomplete. 16. If an elementary rule has more than one action specified, then the decision table is said to be ambiguous. If the elementary rule is logically impossible, then the ambiguity is apparent; otherwise, it is real. 17. A decision table with real ambiguity or incompleteness has a logical error which should be corrected. 18. Incompleteness and ambiguity are easily specified by using a two-dimensional diagram onto which a decision table is mapped. The diagram is called a Karnaugh may (K-map). 19. K-maps are also useful to detect redundant rules. 20. Using basic ideas of Boolean algebra and K-maps, unnecessary conditions and unnecessary rules are eliminated. The number of conditions to be tested in each rule can also be minimized by using K-maps. 21. Pre-processors are available to automatically convert decision tables to program in a programming language. 22. Decision trees are used when sequencing of conditions is important and conditions are to be tested in order of their priority. 23. Structures English is appropriate when a problem has complex actions and many loops. Decision tables are appropriate when there are a large number of conditions to be tested and the logic is complex. Decisiion trees ae preferred when sequencing of conditions is important. Indian Institute of Science Bangalore Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples WORKED EXAMPLES 6.1 A bank has the following policy on deposits: On deposits of Rs. 5000 and above and for three years or above the interest is 12%. On the same deposit for a period less than 3 years it is 10%. On deposits below Rs. 5000 the interest is 8% regardless of the period of deposit. Write the above process using (i) Structured English (ii) A decision table (i) for each deposit do if deposit >=5000 then if period >= 3 years then interest =12% else interest =10% end if else interest =8% end if end for (ii) Deposit >= 5000 Y Y Period >= 3 years Y N Interest 12 10 N – 8 6.2 An organization maintains an employee file in which each record has following data: { Employee No., employee name, employee gross pay}. It has been decided to increase the pay as per the following formula: For pay of Rs. 1000 or less increase 15%. For pay of more than Rs. 1000 but up to Rs. 2500 increase 10%. For pay over Rs. 2500 increase 5%. (i) Write a structured English processing rule corresponding to the above policies. (ii) Express the policies as a decision table. (i) While employee records left in file do Read Number, name , gross pay if gross pay <=1000 then increase = gross pay * 0.15 else if gross pay <= 2500 then increase = gross pay * 0.1 else increase = gross pay * .05 V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/1 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples end if end if Gross pay = gross pay + increase Write Number, name, gross pay end while (ii) While employee records left in file do Read Number, name, gross pay do Table Gross pay <= 1000 Gross pay <= 2500 Percent increase Y – N Y N N 15 10 5 end table Gross pay = gross pay*(1+percent increase/100) Write Number, name, gross pay end while 6.3 An offshore gas company bills its customers according to the following rate schedule: First 500 litres Rs. 10 (flat) Next 300 litres Rs. 1.25 per 100 litres Next 30,000 litres Rs. 1.20 per 100 litres Next 100,000 litres Rs. 1.10 per 100 litres Above this Re. 1.00 per 100 litres The input record has customer identification, name and address, meter reading, past and present. Write a structured English procedure to obtain a bill for the customer. While record left in customer file do Read customer id, name, address, past meter reading, new meter reading Consumption = new meter reading – old meter reading if consumption <= 500 then charge =10 else if consumption <=800 then charge = 10 + (consumption – 500) * 0.0125 else if consumption <= 30800 then charge = 13.75 +(consumption – 800) * 0.012 else if consumption <=130800 then charge = 373.75 + (consumption – 30800) * 0.011 else charge = 1473.75 + (consumption – 130800) * 0.01 end if V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/2 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples end if end if end if write customer id, name, address, past meter reading, new meter reading, consumption, charge end while 6.4 Refer to users requirements stated in exercise 6.4 of Question bank. Develop the processing rules in structured English for the stores process shown in Fig. 5.8. for each customer requisition do if (qty. requested < qty. in stock ) then { qty. issued = qty. requested. qty. in stock = qty. in stock – qty. issued send( customer id , qty. issued ) to accounts process} end if if (qty. in stock <= reorder level) then send reorder request to purchase. end if if (qty. requested = qty. in stock) then { qty. issued = qty. requested qty in stock = 0; send (customer id, qty issued) to accounts send reorder request to purchase } end if if (qty. requested > qty. in stock) then if (partial qty. acceptable) then { qty issued = qty. requested qty in stock = 0; send (customer id , qty issued) to accounts send reorder request to purchase. write (customer id, (qty. requested – qty. issued )) in file} else {qty. issued = 0; send reorder request to purchase write (customer id, qty requested) in back order file } end if end if end for V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/3 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples for each item (with specified item code and qty. accepted note) received from inspection do qty. in stock ( item code) = qty. in stock ( item code) + qty. accepted end for 6.5 Refer to Exercise 6.4 in Question Bank. Develop the processing rules in structured English for the purchase process of Fig. 5.9. for each discrepancy note received from the receiving office do { intimate specified vendor enter discrepancy in the discrepancy file } end for for each goods rejected note received from the inspection office do { intimate specified vendor enter rejected items note in items rejected file } end for for each reorder advice or new requisition received for an item from stores do { Refer to item file to find vendor details and order qty. send order to specified vendor enter order in order file } end for 6.6. State the processing rules in structured English for the various processes in the data flow diagram for the hostel DFD described in Module 5 Mess Process for each absence note do Read student charge record from student charge file (using student number as key) Add absence days to absence field Write student charge record in student charge file end for for each extras note do Read student charge record Append extras code and quantity to record Write student charge in student charge file end for Billing Process While student charge records left in student charge file do Read student charge record from student charge file No. of days to charge = no. of days in a month – no. of days absent. Monthly charge = no. of days to charge * daily rate Total extras charge = 0 for each extra item do V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/4 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples extras charge (code) = extra qty. * charge (code) end for Add extra charge to total extra charge Amount to be billed = no. of days to charge * daily rate + total extras charge Student bill record = student charge record + daily rate, no. of days charged, monthly charge, extras charge (code) , total extras charge , grand total to pay Write student bill record end while (Note: It is assumed that the daily rate, no. of days in a month and extras charge for each extras code is stored in the billing process as an internal data record.) Payment Reconciliation Process for each student Bill record do Store student Bill record in Bill file end for for each payment received do Read bill record of student from Bill file if amount paid = grand total to pay then balance due = 0 else balance due = (grand total to pay – amount paid) Store bill record in unpaid bill file end if end for On payment due date, (due date + 10), (due date + 20) do While records left in unpaid Bill file do if balance due > 0 then send overdue notice, end if end while On (payment due date + 30) do While records left in unpaid bill file do if balance due > 0 then send message to warden end if end while 6.7 The policy followed by a company to process customer orders is given by the following rules: (i) If the customer order <= that in stock and his credit is OK, supply his requirement. (ii) If the customer credit is not OK do not supply. Send him an intimation. V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/5 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples (iii) If the customer credit is OK but items in stock are less than his order, supply what is in stock. Enter balance to be sent in back-order file. Obtain a decision table for above policy Order <= stock Credit OK Y Y Y N N Y N N Supply order Credit not OK Do not supply Supply stock Enter (order – stock) In back Order file X – – – – – X – – X X – – – X – Observe that the last rule is not specified in the statement of rules. This has been added to complete the table. 6.8 Obtain a decision table to decide whether on a given date an employee in an organization has completed one year’s service or not. Let date of joining be DJ/MJ/YJ (Day/Month/Year) Let today’s date be DT/MT/YT (Day/Month/Year) If (YT – YJ) If (MT – MJ) >1 – =1 >0 =1 =0 If (DT – DJ) – – >= 0 E L S E Yes Yes No One year’s service Yes 6.9 Obtain a decision table corresponding to the structured English procedure given in worked example 6.4of decision table for each customer requisition do decision table decision table V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/6 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples qty requested < qty in stock qty requested = qty in stock qty requested > qty in stock (qty in stock – qty requested) <= reorder level Partial order OK? Y – – Y – Y – – – – Y – – – Y – Y – – N – – N Y – qty issued = qty requested qty issued = qty in stock qty in stock = (qty in stock – qty issued) qty in stock = 0 Send customer id,qty issued to account process qty issued = 0 Send reorder request to purchase process Write (customer id, qty requested – qty issued) in back order file Write (customer id, qty requested) in back order file X – X – X – X X – – – – – X – X – – X X X – X – X X – X X – X – X – – – – – X – – – X – – for each item with specified item code and qty accepted note received from inspection do qty in stock ( item code) = qty in stock ( item code) + qty. accepted end for 6.10 Obtain a decision table for an automatic stamp vending machine with the following specifications: (i) To dispense 20, 15, 10, 5 paise stamps (ii) To accept 50, 25, 10, 5 paise coins (iii) Do not return change if it is necessary to return more than two coins of the same denomination. In such a case return the customer’s coin and turn on “no change” light. The machine should dispense a stamp, the right amount of change tendered, no stamp available, no change available, etc. Table 1: Select Stamp Amount tendered Stamp requested available? Amount insufficient V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore < Stamp cost = Stamp cost > Stamp cost – Y Y X – – – N – //V1/June 04/7 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Return amount ‘No stamp’ light on Dispense stamp Go to Table 2 Stop X – – – X Worked Examples – – X – X – – X X – X X – – X Table 2: Make Change Amount tendered Stamp cost 25 ps. Available? 10 ps. Available? 5 ps. Available No of 25 ps. Returned No of 10 ps. Returned No of 5 ps. Returned Dispense stamp No. change light on Return amount Stop 50 20 >=1 – >=1 50 20 – >=2 >=2 50 15 >=1 >=1 – 50 15 >=1 – >=2 1 – 1 X – – X – 2 2 X – – X 1 1 – X – – X 1 – 2 X – – X 50 50 50 25 25 10 5 5 20 15 >=1 >=1 >=1 – – >=1 >= 2 >=1 – >=1 >=1 – >=2 >=1 – 1 1 1 X – – X 1 2 – X – – X 1 1 2 X – – X – – 1 X – – X – 1 – X – – X 25 15 – – >=2 25 10 – >=1 >=1 25 5 – >=2 – 25 5 – >=1 >=2 10 5 – – >=1 E L S E – – 2 X – – X – 1 1 X – – X – 2 – X – – X – 1 2 X – – X – – 1 X – – X – – – – X X X 6.11 Obtain the decision table to be used by a person to enter the office of a manager. The conditions to be checked are: Door open? Ring sign on? Enter sign on? Door locked? The actions a person takes are: Ring bell, enter, wait, leave. After obtaining the decision table, ensure that it has no logical errors and that it is in minimal form. C1: Door open? C2: Ring sign on? C3: Enter sign on? C4: Door locked? Ring bell R1 N N N N R2 N N N Y – – V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore R3 N N Y N R4 N N Y Y R5 N Y N N R6 N Y N Y – – X – R7 N Y Y N R8 N Y Y Y R9 Y N N N X – – R10 R11 R12 R13 R14 R15 Y Y Y Y Y Y N N N Y Y Y N Y Y N N Y Y N Y N Y N ? – ? X ? X R16 Y Y Y Y ? //V1/June 04/8 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Enter Wait Leave – – X A1 – – X A1 X – – – – – X – – X – X A2 A1 A3 A1 X – – A4 – – X A1 Worked Examples – ? X ? – ? X – ? – ? X ? – X ? – ? – ? – A1 A2 A3 A4 ? ? ? Rules R10, R12, R14, R16 have conditions “Door open” and “Door locked” simultaneously true. These rules are thus impossible. Observe these are four distinct actions. The table is mapped on a K-map (Fig. S6.11) NN NY YY YN NN A1 A3 A3 A1 NY A1 A1 YY A1 A1 YN A2 A4 A4 A2 Fig S6.11 k-map for solution 6.11 Decision table with redundancies removed Decision Table with removed (Condition C1 redundant) C2: Ring on? C3: Enter on? C4: Door locked? – – Y N N – N Y N Y N N Y Y N Ring bell Enter Wait Leave – – – X A1 – – – X A1 – X – – A2 X – X – A3 X X – – A4 6.12 In installment buying where payments are made on a weekly basis the action taken on “an account goes into arrears” is a crucial aspect of the operation. Table S6.12 illustrates a simplified arrears procedure. Answer the following questions: (i) Are all elementary rules logically possible? V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/9 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design (ii) (iii) (iv) (v) (vi) Worked Examples Is the table complete? Has the table any ambiguities? Are there logical errors in the table? If yes, point them out. Use reasonable assumptions and correct the table. Remove any redundancies in the corrected table (Table S6.12). Table S6.12 A Simplified Arrears Procedure C1: This week’s cash > weekly rate C2: This week’s cash > 0 C3: Any cash during last month C4: Arrears . >2 * weekly rate C5: Arrears >4 * weekly rate Y – – – N Y – – – Y N Y – Y N N Y – N – – – N – N – – N – Y – N Y N – – N Y Y N – N Y – Y Send arrears letter A Send arrears letter B Send arrears letter C Send arrears letter D Notify accounts Take special action – – – – X – X – – – – – – X – – – – – – – – X – – – X – – – – – – – – X – – – – X – – – – X – – – – – – – X A1 A2 A3 A1 A4 A5 A1 A6 A5 K-map for the decision table C1C2 C1C2 YY NN NY A4 A1 A4 A4 A3 A4 A6 A3 YN A1 C3C4 NN NY YY A1 A4 A1 A4 A1 A1 C3C4 YN NN NY YY A5 A5 A5 ? A2 A5 A2 YN NN NY YY A1 YN C5 = N C5=Y Fig S6.12 Assume weekly rate >0 Impossible rule: C1 = Y C2 = N Impossible rule: C4 = N C5 = Y K- map (Fig. S 9.10) has incompleteness marked by ? C1 C2 C3 V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore C4 C5 //V1/June 04/10 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design N Y Y Y Worked Examples Y Logically contradictory rules C1 C2 C3 C4 C5 N N Y Y Y Y Y Y Y Y N N N N N N Y N Y Y N N N N Y If in all these cases we take action to notify accounts (Action A1) then the K- map becomes the one shown in Fig. S9.11 A1 = C3. C4 + C1 . C5 + C2 . C3 . C5 + C1 . C3 + C1 . C2 . C3 . C5 A2 = C1 . C3 . C5 A3 = C1 . C2 . C3 . C4 . C5 A4 = C2 . C3 . C5 A5 = C1 . C3 . C5 + C2 . C4 . C5 A6 = C2 . C3 . C4 . C5 C1C2 C3C4 NN NY YY YN NN NY YY A4 A1 A1 A4 A1 A1 A6 A1 A3 A1 YN A1 A1 C5=N Fig S.6.13 C1C2 NN C3C4 NY YY YN NN NY V. Rajaraman/IISc. Bangalore YY Indian Institute of Science Bangalore //V1/June 04/11 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design A5 A5 A1 A5 A1 A2 Worked Examples C5=Y FigS6.14 C1: This week’s cash > weekly rate C2: This week’s cash > 0 C3: Any cash during last month C4: Arrears . > 2 * weekly rate C5: Arrears > 4 * weekly rate – – Y N – Y – – – N – Y N – N Y – N – – N Y Y – Y Y – Y – Y N Y Y Y N – N N – N N – N – Y – N – Y Y – N Y Y N Send arrears letter A Send arrears letter B Send arrears letter C Send arrears letter D Notify accounts Take special action – – – – X – – – – – X – – – – – X – – – – – X – – – – – X – X – – – – – – X – – – – – – X – – – – – – – – X – – – – – X – – – X – – 6.13 The policy followed by a company to process customer orders is given by the following rules: (i) If the customer order ≤ that in stock and his credit is OK, supply his requirement. (ii) If the customer credit is not OK do not supply. Send him an intimation. (iii) If the customer credit is OK but items in stock are less than his order, supply what is in stock. Enter the balance to be sent in a back-order file. Obtain a decision table for the above policy. C1 : Customer order <= Item in the stock C2 : Customer credit ok Y V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore Supply requirement //V1/June 04/12 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples C2 Y Do not supply send intimation N C1 N Supply what is in the stock. Enter balance in the back order file Y N C2 Do not supply send intimation 6.14 Obtain a decision tree to be used by a person to enter the office of a manager. The conditions to be checked are: Door open? Ring sign on? Enter sign on? Door locked? The actions a person takes are: Ring bell, enter, wait, leave. After obtaining the decision table, ensure that it has no logical errors and that it is in minimal form. C1 : Door open C2 : Ring sign on C3 : Enter sign on C4 : Door locked Y Ring bell and enter C3 Y N N N Y C2 Y C1 N C3 N C4 Y Ring bell and wait Enter Leave Leave Observe that C1 is not relevant and not clear in the Decision tree V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/13 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples 6.15 A University has the following rules for a student to qualify for a degree with Physics as the main subject and Mathematics as the subsidiary subject: (i) he should get 50% or more marks in Physics and 40% or more marks in Mathematics. (ii) If he gets < 50% marks in Physics, he should get 50% or more marks in Mathematics. He should, however, get at least 40% marks in Physics. (iii) If he gets < 40% marks in Mathematics and 60% or more marks in Physics, he is allowed to reappear in Mathematics examination only so that he can qualify. Obtain a decision tree for the above problem Pass Y C2 Y N C1 C4 Appear in mathematics Y N N Y C3 Fail C5 Y Pass N Fail N Fail V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/14 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples Pass >=50 >=50 C2 >=40 Pass < 40 Repeat math C1 >=40 >=60 < 40 Fail (An incorrect tree. This is not correct as rule ii not correctly interpreted) C1 : Physics Marks C2 : Math marks C3 : Math marks >=50% CORRECTED DECISION TREE >=50 C1 Pass Fail C2 >=40 Pass C3 Fail >=60 C2 <40 Pass Repeat math Fail V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/15 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/ Structured systems analysis and design Worked Examples 6.16 You want to go to Delhi from Bangalore. There are three flights per day; early morning, late morning and evening. You would like to go on 21.4.04 by early morning flight. If it is not available you will take the late morning flight or evening flight in that order. If neither is available you are willing to take any flight on 22.4.04 but prefer early and late morning flights., Obtain a decision tree for this word statement. Is decision table suitable for this problem? If not why? Book ticket C1 N Y Book ticket Y C2 Book ticket N Y C3 Book ticket N Y C4 Book ticket N Y C5 Book ticket N Y C6 N No ticket available C1 : Is ticket available on early morning flight on 21/4/04 C2 : Is ticket available on late morning flight on 21/4/04 C3 : Is ticket available on evening flight on 21/4/04 C4 : Is ticket available on early morning flight on 22/4/04 C5 : Is ticket available on late morning flight on 22/4/04 C6 : Is ticket available on evening flight on 22/4/04 V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore //V1/June 04/16 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions 6.1 Structured English is used to describe a. how programs are to be written b. processes in a DFD in a reasonably precise manner c. how DFDs are used in data processing d. data flows in DFD 6.2 Structured English is a a. structured programming language b. description of processes in simple English c. method of describing computational procedures reasonably precisely in English d. natural language based algorithmic language 6.3 The objective of using structured English is to a. describe computational procedures reasonably precisely which can be understood by any user b. expand a DFD so that a user can understand it c. develop algorithms corresponding to processes in a DFD d. ease writing programs for DFDs 6.4 Structured English description of processes (i) should be understandable to a user of a computer based system (ii) should be understandable to a programmer (iii) can be descriptive in nature (iv) should be translatable by a compiler a. i and iii b. ii and iv c. i, ii and iv d. i and ii 6.5 A decision table is a. a truth table b. a table which facilitates taking decisions c. a table listing conditions and actions to be taken based on the testing of conditions V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/1 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions d. a table in a Decision Support System 6.6 A decision table a. has a structured English equivalent representation b. cannot be represented using structured English c. does not have an equivalent algorithmic representation d. cannot be used to represent processes in a DFD 6.7 A decision table is preferable when the number of a. conditions to be checked in a procedure is small b. conditions to be checked in a procedure is large c. actions to be carried out are large d. actions to be carried out are small 6.8 Select from the following list which are appropriate to use in structured English description of a process (i)process inventory records (ii)find the sum of outstanding billed amounts (iii)check if outstanding amount >= Rs. 5000 (iv)check if stock is low a. i and ii b. i and iii c. iii and iv d. ii and iii 6.9 Structured English statements must be a. short and clear b. specified quantitatively c. specified qualitatively d. detailed and descriptive 6.10 Select statements from the following list which may be used in structured English (i)if marks are too low fail student (ii)if marks >=60 enter first class (iii)if average height select candidate V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/2 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions (iv)if weight < 40 kg. reject candidate a. i and ii b. ii and iii c. iii and iv d. ii and iv 6.11 Select correct decision structures from the following (i)if total marks>=75 then enter distinction in student record end if (ii) if total marks >=50 then enter pass in student record else enter fail in student record end if (iii) if total marks >=60 then enter first class in student record else if total marks>= 50 then enter second class in student record else enter fail in student record end if end if (iv) if attendance <30% then do not admit in examination else a. ii and iii b. i and ii c. iii and iv d. i and iv V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/3 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions 6.12 The following structured English procedure is incorrect because if balance in account <=0 then {issue exception note to dept. mark “stop future issues” in departments record} else if balance in account <minimum balance then { issue item to dept. issue warning to dept.} end if end if a. end if in second if is not needed b. nesting of ifs is not correct c. no action is specified when balance in account >=minimum balance d. the value of minimum balance is not specified 6.13 The following structural English is incorrect because case (income slab) Income slab =1 : tax= 10% Income slab =2 or 3 : Income slab =5 : tax= 20% tax= 30% end case a. no action is specified for income slab of 4 b. income slab has to be rupees c. income slab =2 or 3 is wrong d. number of cases is too small V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/4 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions 6.14 The following structured English procedure is incorrect because case (code) Code=2 : if purchase amount >=5000 then discount=5% Code=1 :discount=2% Code=3 :if purchase amount >=4000 then discount =2% else if code=4 then discount =5% end if None of the above codes : discount=0 end case a. code=2 should appear after code=1 b. if statement cannot be used within a case c. code=4 should not be used in the action for code=3 d. The statement is correct 6.15 The following while structure is wrong because balance =500 while balance <=1000 do Write (amount due – balance) Read next record end while a. read must appear before write b. this loop will never terminate c. no read allowed in a loop d. the contents of next record is not known 6.16 Structured English description of data processing is a a. non-procedural specification b. procedural specification V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/5 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions c. purely descriptive specification d. very imprecise specification 6.17 Decision table description of data processing is a. non-procedural specification b. procedural specification c. purely descriptive specification d. very imprecise specification 6.18 In the following word statement the conditions are:“if a student gets 50 marks or more in mathematics and 40 marks or more in English he passes the examination, otherwise he fails” a. student passes the examination b. student fails the examination c. student gets 50 marks or more in mathematics d. student mathematics marks >= 50 and student English marks 6.19 In the following word statement the actions are“if a student gets 50 marks or more in mathematics and 40 marks or more in English he passes the examination, otherwise he fails” (i)student passes the examination (ii)student fails the examination (iii)student gets 50 marks or more in mathematics (iv)student mathematics marks >= 50 and student English marks >= 40 a. i and ii b. i and iii c. ii and iii d. iii and iv 6.20 In a limited entry decision table the condition stub a. lists X or – corresponding to actions to be executed b. lists the conditions to be tested c. has Y or N or – entries d. lists the actions to be taken V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/6 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions 6.21 In a limited entry decision table the condition entries a. list X or – corresponding to actions to be executed b. list the conditions to be tested c. have Y or N or – entries d. list the actions to be taken 6.22 In a limited entry decision table the action stub a. lists X or – corresponding to actions to be executed b. lists the conditions to be tested c. has Y or N or – entries d. lists the actions to be taken 6.23 In a limited entry decision table the action entries a. list X or – corresponding to actions to be executed b. list the conditions to be tested c. have Y or N or – entries d. list the actions to be taken 6.24 In a limited entry decision table the condition entries may be a. Y or N only b. Y, N or – c. A binary digit d. Any integer 6.25 In a limited entry decision table a—entry against a condition signifies that a. the outcome of testing the condition is irrelevant b. it is an important condition c. the condition should be tested d. the condition is a Boolean condition 6.26 A rule in a limited entry decision table is a a. row of the table consisting of condition entries b. row of the table consisting of action entries c. column of the table consisting of condition entries and the corresponding action entries V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/7 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions d. columns of the tables consisting of conditions of the stub 6.27 The conditions in the condition stub of a limited entry decision table a. must be in sequential order b. must be in the order in which they are to be tested c. may be in any order d. must be in the order in which they are to be executed 6.28 The actions in the action stub of a limited entry decision table a. must be in sequential order b. must be in the order in which they are to be tested c. may be in any order d. must be in the order in which they are to be executed 6.29 A X against an action in an action row signifies that the a. action is not to be taken b. action is to be taken c. action is important d. action is not important 6.30 A—against an action in an action row signifies that the a. action is not to be taken b. action is to be taken c. action is important d. action is not important 6.31 An extended entry decision table has a. only Y, N or – entries b. entries which extend the condition c. questions asked extended into the condition entry part of the table d. only numerical entries 6.32 An extended entry decision table a. has no limited entry equivalent b. cannot be replaced by a table with only Y, or – entries c. may have Yes, No answers to conditions d. can always be converted to an equivalent limited entry decision tabl V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/8 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions 6.33 An extended entry decision table is a. very difficult to understand b. quite concise compared to a limited entry decision table developed for the same task c. large compared to a limited entry table developed for the same task d. is not very often used 6.34 A mixed entry decision table a. may have some conditions with Y, N, or – entries b. may not have any Y, N, or – entry c. may have only non-numerical entries d. may mix numerical and non-numerical entries Given a decision table “test” shown below R1 R2 R3 C1 Y N Y C2 N – Y A1 X –– A2 – X – A3 X – X Decision table–“test” Answer the following questions: 6.35 Rule R1 is interpreted as follows: a. If C1 is TRUE and C2 is FALSE then perform action A2 b. If C1 is TRUE and C2 is FALSE then perform action A1 and then action A2 c. If C1 is TRUE and C2 is FALSE then perform action A3 and then action A1 d. If C1 is TRUE and C2 is FALSE then perform action A1 and then action A3 6.36 Rule R3 is interpreted as follows: V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/9 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions a. If C1 is TRUE and C2 is TRUE then perform action A1 and A b. If C1 is TRUE or C2 is TRUE then perform action A3 c. If C1 is TRUE and C2 is TRUE then perform action A1 or A2 d. If C1 is TRUE and C2 is TRUE then perform action A3 6.37 Structured English equivalent of the decision table “test” are given below (i) if C1 TRUE then if C2 TRUE then do A3 else do A1 and A3 end if else do A2 end if (ii) if C1 FALSE then do A2 else if C2 TRUE then do A3 else do A1 and A3 end if end if (iii)if C2 TRUE then if C1 TRUE then do A3 else do A2 end if else do A1 and A3 end if (iv)if C2 FALSE then if C1 TRUE then do A1 and A3 V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/10 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions else do A2 end if else do A3 end if Which of the following are correct? a. i and iii b. i and ii c. iii and iv d. ii and iv 6.38 Structured English equivalents of decision table “test” are given below. Pick the right one (i)if C1 TRUE and C2 FALSE then R=1 end if if C1 FALSE then R=2 end if if C1 TRUE and C2 TRUE then R=3 end if case (R) R=1; perform actions A1 and A3 R=2; perform action A2 R=3; perform action A3 end case (ii)if C1 TRUE and C2 FALSE then perform actions A1, A3 end if if C1 FALSE then perform action A2 end if if C1 TRUE and C2 TRUE then perform action A3 end if (iii)case (C1 TRUE and C2 FALSE) Rule R1 case (C1 FALSE) Rule R2 case (C1 TRUE and C2 TRUE) Rule R3 end case (iv)if C1 TRUE and C2 TRUE then do Rule R3 end if V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/11 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions if C1 TRUE and C2 FALSE then do Rule R1 end if if C1 TRUE then do Rule R2 end if a. i and ii b. i and iii c. ii and iii d. iii and iv a. The Elementary Rule Decision Table equivalent of decision table “test” is C1 Y N Y C2 N N Y A1 X – – A2 – X – A3 X– b.C1 Y c. X N Y C2 N Y Y A1 X – – A2 – X – A3 X – X C1 Y N N Y C2 N N Y Y A1 X – – – A2 – X X – X– – X A3 V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/12 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions d. C1 Y N N Y C2 N N Y Y A1 X – – – A2 – X – – A3 X – X X 6.39 The decision table “test” is a. ambiguous b. contradictory c. incomplete d. complete Answer the following referring to the decision table “test2” R1 R2 C1 : x <= 50 N – C2 : x >= 70 – N A1 X – A2 – X Decision Table: “test2” 6.40 Decision table “test2” is a. really incomplete b. complete c. apparently incomplete d. apparently complete 6.41 Decision table “test2” a. has a real ambiguity b. has an apparent ambiguity c. is logically correct V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/13 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions d. is incomplete C1 N – C2 – N A1 Y – A2 Y DECISION TABLE “testing”– 6.42 Decision table “testing” can be made complete (i)by putting an ELSE rule (ii)is as it is complete and does not need any more rules (iii)by specifying actions when C1 = Y and C2 = Y (iv)by specifying actions when C1 = N and C2 = N a. (i), (ii) b. (i), (iii) c. (ii), (iii) d. (ii), (iv) 6.43 The K-map equivalent of C1 a. C2 table “test2” is C1 Y Y N decision A2 N C2 Y N A1 Y A1 A2 A1 N A2 A1 V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore b. M6/V1/July 04/14 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions c. d. C1 Y C1 N Y C2 N C2 Y N A2 A1 Y A1,A2 N 6.44 The following structured if A1 A2 decision English table A2 equivalent statement of the is C2 TRUE then if C1 TRUE then do A3 else do A2 do A1 and A3 end if else end if a. b. C1 Y Y N C2 Y N – A1 – – X A2 – X – A3 X – X C2 Y Y N V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/15 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions c. d. C1 6.45 C1 Y N N A1 – – X A2 – X – A3 X – X C1 Y N – C2 Y Y N A1 – – X A2 – X – A3 X – X Y N Y C2 Y Y N A1 – – X A2 – X – A3 X – X The decision table equivalent of the following structured English statement if is balance in account <=0 then{issue exception note to dept. and mark “stop future issues”} else if balance in account <min. balance then {issue item to dept. issue warning to dept.} V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/16 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions else {issue item to dept.} end if end if C1=balance in account <=0; C2=balance in account < min. balance A1=issue exception note and mark “no future issues” A2=issue item to dept A3=issue warning to dept. a. b. c. C1 Y N N C2 – Y N A1 X – – A2 – X X A3 – X – C1 Y N N Y C2 N Y N Y A1 X – – – A2 – X X X A3 – X – – C1 N N N C2 – Y N A1 X – – A2 – X X A3 – X – V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/17 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions d. C1 Y N Y C2 N Y N A1 X – – A2 – X X A3 – X – 6.46 The decision table given in answer (a) of question 9.4.3 is a. incomplete b. apparently ambiguous c. has contradictory specifications d. logically complete 6.47 The rule C1=Y, C2=Y in the decision table given in answer (a) of question 6.3.7 is e. logically impossible f. logically possible g. has no action specified h. has multiple actions specified 6.48 If min. balance > 0 then the rule C1=Y, C2= – in the decision table given in answer (a) of question 6.3.7 may be replaced by the rule i. C1=Y, C2=N j. C1=Y, C2=Y k. C1= –, C2=Y l. C1= –, C2=N 6.49 The actions of a decision table are mapped on a K-map shown be The boxes marked X denote impossible rules C1C2 C3 NN NY YY Y A1 A1 A2 N A1 A2 A2 V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore YN M6/V1/July 04/18 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions The rule for action A1 may be represented by the following minimal Boolean expression a. C1.C2 + C1.C2.C3 b. C1.C2.C3 + C1.C3 c. C1.C3 + C2 d. C1.C3 + C2.C1 6.50 The following decision table may be replaced by its best equivalent shown a. b. below: C1 N C2 N N Y Y Y Y N N C3 Y N N Y Y N N Y A1 X – – X – – X X A2 – X X – X X X X C1 N N Y Y C2 – – Y N C3 Y N – – A1 X – – X A2 – X X X C1 – Y N Y C2 – – – N C3 N – Y – A1 – – X X V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore N N N Y Y Y Y M6/V1/July 04/19 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions c. d. A2 X X – X C1 N – Y N Y C2 – Y Y – N C3 N N – Y – A1 – – – X X A2 X X X – X C1 Y N N Y C2 – – – N C3 – N Y – A1 – – X X A2 X X – X 6.51 The following decision table may be replaced by its best equivalent shown below: a. C1 N C2 N N Y Y Y Y N N C3 Y N N Y Y N N Y A1 X – – X – – X X A2 – X X – X X X X C1 N N Y Y C2 – – Y N C3 Y N – – A1 X – – X A2 – X X X V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore N N N Y Y Y Y M6/V1/July 04/20 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions b. c. d. 6.52 C1 – Y N Y C2 – – – N C3 N – Y – A1 – – X X A2 X X – X C1 N – Y N Y C2 – Y Y – N C3 N N – Y – A1 – – – X X A2 X X X – X C1 Y N N Y C2 – – – N C3 – N Y – A1 – – X X A2 X X – C1 N N C2 N N Y Y Y Y N N C3 Y N N Y Y N N Y A1 X – – X – – X X V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore N N X Y Y Y Y M6/V1/July 04/21 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions a. b. c. d. A2 – X X – C1 N N Y Y C2 – – Y N C3 Y N – – A1 X – – X A2 – X X X C1 – Y N Y C2 – – – N C3 N – Y – A1 – – X X A2 X X – X C1 N – Y N Y C2 – Y Y – N C3 N N – Y – A1 – – – X X A2 X X X – X C1 Y N N Y C2 – – – N C3 – N Y – V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore X X X X M6/V1/July 04/22 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions A1 6.53 – – X X A2 X X – Given the R1 X decision table “test 3”answer the following questions: R2 R3 R4 R5 R6 R7 x>=20 Y Y Y Y N N N N x<=30 Y Y N N Y Y N N y>=x Y N Y N Y N Y N A1 X X X X – – – – A2 – – – – X X – – A3 – – – – – – X X R8 a. Rules R7, R8 are logically impossible b. Rules R5, R6 are logically impossible c. Rules R3, R4 are logically impossible d. Rules R1, R2 are logically impossible 6.54 Pick the correct equivalent of “test 3” a. C1 Y N b. A1 X – A2 – X Y N N C2 – Y N A1 X – – A2 – X – A3 – – X C1 Y N N C2 – Y N c. C1 Y Y N N C3 N Y N Y C2 – – – – A1 X X – – A1 X – – A2 – – X X A2 – X – V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore d. C1 M6/V1/July 04/23 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions A3 – – X 6.55 The decision table “test 3“ is a. Incomplete b. Ambiguous c. Incorrect d. .has redundancies 6.56 The decision table equivalent of the following Boolean expression is A1= C3.C1.C2 + C2.C3.C1 A2= C1.C3 + C3.C2.C1+ C1.C2.C3 a. C1 Y Y Y N N C2 Y N – N N C3 N Y Y Y N A1 X X – – – A2 – – X X X b. C1 Y Y Y N N C2 Y N N N N C3 Y Y – Y N A1 X X – – – A2 – – X X X V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/24 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions c. C2 Y Y Y N N C1 Y N – N N C3 N Y Y Y N A1 X X – – – A2 – – X X X d. C1 Y Y Y N N C2 Y N – N N C3 N Y Y Y N A1 X X – – – A2 X X X X X 6.57 A decision table “test 4” is given below C1 Y Y N – – N Y N C2 Y – N Y – N N – C3 Y Y Y – Y N N N C4 – Y – Y N – – N A1 X X X – – – – – A2 – – – X X – – – A3 – – – – – X X – ? – – – – – – – I where I indicates impossible rule The contradictory rules are a. YYYY, NYYY, NNYY V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/25 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions b. YYYN, NYYN, NNYN c. YYYY, YYYN, NNYN d. There are no contradictory rules 6.58 a. In “test 4” the contradictory actions are: A1, A3 b. A1, A2 c. A2, A3 d. A2, I 6.59 In “test 4” missing rule is: e. NYNN f. NYYN g. YYNN h. YNYN 6.60 If in “test 4” the rules where the contradictory actions or unspecified actions are present, the action is replaced by A2 only, the reduced decision table using impossible rules also for reduction is: a. b. C1 – – – – – N C2 N – Y Y – N C3 Y Y – Y N N C4 Y N Y – N – A1 X – – – – – A2 – X X X – – A3 – – – – X X C1 N Y – – – N V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore N M6/V1/July 04/26 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions c. d . C2 N N Y Y – – N C3 Y Y N Y Y N N C4 Y Y Y – N N – A1 X X – – – – – A2 – – X X X – – A3 – – – – – X X C1 – – – – N C2 N – Y – N C3 Y Y – N N C4 Y N Y N – A1 X – – – – A2 – X X – – A3 – – – X X C2 N Y – N C3 Y – Y N C4 Y – N – A1 X – – – A2 – X X – A3 – – – X 6.61 Decision Trees are preferred when a. Too many conditions need to be tested b. Sequencing of testing conditions is important c. When there are many loops to be performed d. When too many actions are to be taken V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/27 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions 6.62 Decision Tables are preferred when a. Too many conditions need to be tested b. Sequencing of testing conditions is important c. When there are many loops to be performed d. When too many actions are to be taken 6.63 Structured English is preferred when a. any conditions need to be tested b. Sequencing of testing conditions is important c. When there are many loops to be performed d. When too many actions are to be taken 6.64 The objective of using decision trees is to a. Expand a DFD so that a user can understand it b. To specify sequence of conditions to be tested and actions to be taken c. Describe a computational procedure that can be easily understood by a person d. 6.65 Use it as a tool in decision support system Decision trees are superior to decision tables when a. The number of conditions to be tested is very large b. When sequence of testing conditions is not particularly important c. When sequence of testing conditions is not particularly important d. 6.66 When a large number of actions are to be specified Logical correctness of a specifications can be systematically checked by a. Using decision trees b. Using structured English c. Using DFD’s d. 6.67 Using decision tables The decision tree equivalent of the following structured English is if C2 then if C1 then A3 V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/28 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions else A2 endif else A1,A3 endif A3 Y C2 Y a. N A2 C1 N A1, A3 Y b. A3 C1 Y A2 N C2 A1 Y N C1 A3 N Y Y c. C1 A3 N A2 C2 N V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore A1, A3 M6/V1/July 04/29 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions A2 C1 d. A3 C2 A1A3 6.68 Decision tables are better then Decision trees when a. Conditions are to be isolated from actions in a word statement b. Condition sequences are to be found from a word statement c. Logical correctness of a word statement is to be established d. Large number of actions is to be performed 6.69 The decision table equivalent of the Decision tree of choice (a) of 6.5.7 is a. C2 C1 Y N N Y N N Y Y A1 A2 A3 X X X - X X - X b. C1 C2 Y Y Y N N - A1 A2 A3 X X - X X c. C1 C2 Y Y Y N A1 A2 A3 X X - V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore N Y X X M6/V1/July 04/30 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions d. C1 C2 Y Y Y N A1 A2 A3 X X - V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore N Y X X Error M6/V1/July 04/31 Prof. V.Rajaraman System Analysis and Design System Analysis and Design/Structured Systems Analysis and Design Multiple Choice Questions Key to Objective Questions 6.1 b 6.2 c 6.7 b 6.8 d 6.9 b 6.10 6.13 a 6.14 c 6.15 b 6.16 b 6.17 a 6.18 a 6.20 6.21 c 6.22 d 6.23 a 6.24 6.19 6.3 b a 6.4 d 6.5 d c 6.11 6.6 a a 6.12 6.25 a 6.26 c 6.27 c 6.28 d 6.29 b 6.30 6.31 c 6.32 d 6.33 b 6.34 a 6.35 d 6.36 6.37 b 6.38 a 6.39 c 6.40 d 6.41 c 6.43 6.49 b b c d b a d 6.42 a 6.44 c 6.45 c 6.46 a 6.47 d 6.48 b 6.50 c 6.51 a 6.52 b 6.53 a 6.54 a a 6.57 c 6.58 b 6.59 6.55 d 6.56 6.61 b 6.62 a 6.63 c 6.67 c 6.68 c 6.69 b V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore 6.64 b 6.65 c c 6.60 6.66 d d M6/V1/July 04/32 Prof. V.Rajaraman System Analysis and Design System Analysis and Design / Structured Systems Analysis and Design Question Bank QUESTION BANK – MODULE 6 6.1 A bank has the following policy on deposits: On deposits of Rs.5000 and above and for three years or above the interest is 12%. On the same deposit for a period less than 3 years it is 10%. On deposits below Rs.5000 the interest is 8% regardless of the period of deposit. Write the above process using i. Structured English ii. A decision table 6.2 An organization maintains an employee file in which each record has the following data: (Employee No., employee name, employee gross pay). It has been decided to increase the pay as per the following formula: For pay of Rs.1000 or less increase 15% For pay of more than Rs.1000 but up to Rs.2500 increase 10%. For pay over Rs.2500 increase 5%. i. Write a structured English processing rule corresponding to the above policies ii. Express the policies as a decision table. 6.3 An offshore gas company bills its customer according to the following rate schedule: First 500 litres Rs. 10 (flat) Next 300 litres Rs.1.25 per 100 litres Next 30,000 litres Rs.1.20 per 100 litres Next 100,000 litres Rs.1.10 per 100 litres Above this Rs.1.00 per 100 litres. The input record has customer identification, name and address, meter reading, past and present. Write a structured English procedure to obtain a bill for the customer. 6.4 A narrative of a user’s requirements in an organization is given below: "Our company receives a number of items from many vendors and they are received at the receiving office. As we receive over 1000 items a day it is now virtually impossible for the receiving office to check whether the vendor has supplied items against an order, or sent a wrong item and inform the purchase office. We are also not able to find out if there are excesses or deficiencies in delivery and whether the vendor adhered to the delivery schedule as per the order. The items received at the receiving office are sent for physical inspection. The physical inspection consists of checking whether the quantities stated in the delivery note agree with the physical count, whether the item is the correct one ordered, and a check on the quality of item. We would like to keep a record of rejections due to bad quality, incorrect items, excess/deficient supply etc., determined during inspection. This will enable us to assess vendors' reliability to guide us in placing orders in the future, besides keeping track of supplies. Items cleared by the inspection office are taken into the inventory by the stores office which keeps a ledger of items stocked and quantity available of each item. Customers send requisitions to the stores. The stores fulfill the requests based on availability and update the ledger. Currently we are not able to meet some of our customers' requests. We would like to incorporate automatic reordering by our purchase office if the inventory level of an item is low. We would also like to keep track of unfulfilled requests and meet them when items reach the store. Currently we are not able to pay our vendors promptly due to delays in payment V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/1 Prof. V.Rajaraman System Analysis and Design System Analysis and Design / Structured Systems Analysis and Design 6.5 6.6 6.7 6.8 6.9 Question Bank order reaching our accounts office. We would like to rectify this. We would also like to bill our customers promptly and keep track of customers' payments" Develop the processing rules in structured English for the office receiving the goods specified in the user’s requirements. Develop the processing rules in Structured English for the inspection process of the user’s requirements stated in Exercise 6.4 Develop the processing rules in Structured English for the purchase process of the user’s requirements stated in Exercise 6.4. Develop the processing rules in Structured English for the accounting process stated in Exercise 6.4 Develop the processing rules in Structured English for the stores process stated in Exercise 6.4 The policy followed by a company to process customer orders is given by the following rules: (i) If the customer order ≤ that in stock and his credit is OK, supply his requirement. (ii) If the customer credit is not OK do not supply. Send him an intimation. (iii) If the customer credit is OK but items in stock are less than his order, supply what is in stock. Enter the balance to be sent in a back-order file. Obtain a decision table for the above policy. V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/2 Prof. V.Rajaraman System Analysis and Design System Analysis and Design / Structured Systems Analysis and Design Question Bank 6.10 Obtain a decision table to decide whether on a given date an employee in an organization has completed one year's service or not. 6.11 Obtain a decision table for an automatic stamps vending machine with the following specifications: (i) To dispense 20, 15, 10, 5 paise stamps (ii) To accept 50, 25, 10, 5 paise coins (iii) Do not return change if it is necessary to return more than two coins of the same denomination. In such a case return the customer's coin and turn on "no change" light. The machine should dispense a stamp, the right amount of change, no stamp available, no change available signals etc. 6.12 Obtain a decision table to be used by a person to enter the office of a manager. The conditions to be checked are: Door open? Ring sign on? Enter sign on? Door locked? The actions a person takes are: Ring bell, enter, wait, leave. After obtaining the decision table, ensure that it has no logical errors and that it is in minimal form. 6.13 A University has the following rules for a student to qualify for a degree with Physics as the main subject and Mathematics as the subsidiary subject: (i) he should get 50% or more marks in Physics and 40% or more marks in Mathematics. (ii) If he gets < 50% marks in Physics, he should get 50% or more marks in Mathematics. He should, however, get at least 40% marks in Physics. (iii) If he gets < 40% marks in Mathematics and 60% or more marks in Physics, he is allowed to reappear in Mathematics examination only so that he can qualify. (a) obtain an EEDT for the rules (b) obtain an LEDT for the rules check the logical correctness of the decision table 6.14 In instalment buying where payments are make on a weekly basis the action taken on "an account goes into arrears" is a crucial aspect of the operaiton. Table P6.14 illustrates a simplified arrears procedure. Answer the following questions: (i) Are all elementary rules logically possible? (ii) Is the table complete? (iii) Has the table any ambiguities? (iv) Are there logical errors in the table? If yes, point them out. (v) Use reasonable assumptions and correct the table. (vi) Remove any redundancies in the corrected table (Table 6.) 6.15 Obtain a decision tree for Exercise 6.9. 6.16 Obtain a decision tree for exercise 6.13. Is it possible to find out missing rules if any in a decision tree representation. 6.17 Obtain a decision tree for Exercise 6.12. 6.18 Explain in what types of problems you will use a decision tree approach rather than a decision table approach. 6.19 You want to go to Delhi from Bangalore. There are three flights per day; early V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/3 Prof. V.Rajaraman System Analysis and Design System Analysis and Design / Structured Systems Analysis and Design Question Bank morning, late morning and evening. You would like to go on 21.4.04 by early morning flight. If it is not available you will take the late morning flight. If neither is available you are willing to take any flight on 22.4.04 but prefer early and late morning flights., Obtain a decision tree for this word statement. Is decisiont able suitable for this problem? If not why? 6.20 Explain in what types of problemsyou will prefer Structured English process specification rather than decision tree. Table P.6.14 A simplified Arrears Procedure C1: This week's cash > weekly Y Y N N − − − − − rate C2: This week's cash > 0 Y Y N N N − − − − C3: Any cash during last month − N N Y Y Y − − − C4: Arrears > 2 * weekly rate Y N N Y − − − − − C5: Arrears > 4 * weekly rate N Y N N Y N Y − − Send arrears letter A Send arrears letter B Send arrears letter C Send arrears letter D Notify accounts Take special action V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore − − − − X − A1 X − − − − − A2 − X − − − − A3 − − − − X − A1 − − X − − − A4 − − − − − X A5 − − − − X − A1 − − − X − − A6 − − − − − X A5 M6/V1/July 04/4 Prof. V.Rajaraman System Analysis and Design System Analysis and Design / Structured Systems Analysis and Design Pointers References 1. V.Rajaraman, “Analysis and Design of Information Systems”, 2nd Edition, Prentice Hall of India, New Delhi, 2002. Most of the material in this module is based on Chapter 8 and 9 of the above book. The book is perhaps the only one which has extensive discussion on error detection in Decision Tables. 2. K.E. Kendall and J.E.Kendall, “Systems Analysis and Design”, 5th Edition, Pearson Education Asia, Delhi, 2003. Has a brief discussion of structured English, Decision Tables and Decision Trees (pages 353 to 369). Website www.prenhall.com/kendall has a lot of support material and case study for students. 3. J.A.Hoffer, J.F.George, J.S.Velacich, “Modern Systems Analysis and Design”, Third Edition, Pearson Education Asia, 2002. Chapter 7 (pages 282 to 303) cover the topics in this module. The book has a number of interesting case studies and a good problem set. The web site http://prenhall.com/hoffer has material to assist students who use this text book. 4. E.Yourdon “Modern Structured Analysis”, Prentice Hall of India, 1996. Chapter 11 (pages 203 to 232) describes structured English and Decision Tables. There is a larger set of exercises at the end of the chapter. V. Rajaraman/IISc. Bangalore Indian Institute of Science Bangalore M6/V1/July 04/1
© Copyright 2024