Systems Analysis and Design · Unit 9
Logic Modeling and Documentation
Exam-focused notes for Logic Modeling and Documentation (Systems Analysis and Design, BIT253): what the TU syllabus asks and how it has actually been tested, with 6 solved past questions from this unit.
Logic Modeling and Documentation in short
Once requirements are known, the analyst must describe the rules inside processes, test the system, and write the documents and training that keep it useful. This chapter covers those supporting tasks.
What this unit covers
- Decision table with examples
- Decision tree modeling
- Pseudocode definition and examples
- Software testing importance
- Software testing techniques
- Documentation importance
- Training importance
- System maintenance factors and maintainability
Decision tree modeling
2081 · 5 marks
How do you model logic using decision tree? Explain with an example. [5]
Show solved answerHide answer
Modeling Logic Using Decision Trees
What is a Decision Tree?
A decision tree is a tree-structured model used to represent decisions and their possible consequences. It models logical conditions (if-then-else logic) in a hierarchical, visual form that is easy to understand and implement.
Structure of a Decision Tree
| Component | Description |
|---|---|
| Root Node | The topmost node representing the first/main decision or condition |
| Internal Node | Represents a test on an attribute or condition |
| Branch | Represents the outcome (Yes/No, True/False) of a test |
| Leaf Node | Represents the final decision, class label, or result |
How Logic is Modeled
Each internal node corresponds to a logical condition (predicate), and each branch corresponds to the truth value of that condition. The path from root to a leaf encodes a conjunction of conditions (AND logic), while multiple paths to the same result encode disjunction (OR logic).
A decision tree is essentially a graphical representation of nested if-then-else statements.
Example: Deciding Whether to Play Cricket
Conditions (Attributes):
- Weather: Sunny / Rainy
- Wind: Strong / Weak
Decision Table:
| Weather | Wind | Play Cricket? |
|---|---|---|
| Sunny | Weak | Yes |
| Sunny | Strong | No |
| Rainy | Weak | Yes |
| Rainy | Strong | No |
Decision Tree:
[Weather?]
/ \
Sunny Rainy
| |
[Wind?] [Wind?]
/ \ / \
Weak Strong Weak Strong
| | | |
YES NO YES NO
Equivalent Logical Expression
Reading the YES paths from the tree:
Play Cricket = (Weather = Sunny AND Wind = Weak)
OR
(Weather = Rainy AND Wind = Weak)
This can be simplified as:
Play Cricket = Wind = Weak
This shows how a decision tree discovers and models logical rules from data.
Equivalent If-Then-Else Code
if Weather == "Sunny":
if Wind == "Weak":
return "Yes"
else:
return "No"
else: # Rainy
if Wind == "Weak":
return "Yes"
else:
return "No"
Key Points
- Each path in the tree represents a logical rule
- Decision trees can model AND, OR, and NOT logic
- They are used in machine learning, expert systems, and database query optimization
- They convert complex logical conditions into a simple, readable tree structure
Decision table with examples
Documentation importance
Pseudocode definition and examples
2080.2 · 5 marks
Explain pseudocode with example. [5]
Show solved answerHide answer
Pseudocode
Definition
Pseudocode is an informal, high-level description of an algorithm that uses a mixture of natural language and programming-like constructs to describe the steps of a solution. It is not written in any specific programming language syntax, so it cannot be directly executed by a computer. It serves as a planning tool to outline the logic of a program before actual coding begins.
Key Characteristics of Pseudocode
- Uses plain English mixed with programming constructs
- Has no strict syntax rules
- Is language-independent (not tied to C, Python, Java, etc.)
- Easy to read and understand by both programmers and non-programmers
- Focuses on logic rather than implementation details
Common Pseudocode Constructs
| Construct | Example |
|---|---|
| Input | READ number |
| Output | PRINT result |
| Assignment | sum = a + b |
| Decision | IF...THEN...ELSE...ENDIF |
| Repetition | WHILE...DO...ENDWHILE |
| Loop | FOR i = 1 TO n |
Example: Find the Largest of Two Numbers
Problem: Read two numbers and print the larger one.
BEGIN
READ num1, num2
IF num1 > num2 THEN
PRINT "num1 is larger"
ELSE
PRINT "num2 is larger"
ENDIF
END
Example: Sum of First N Natural Numbers
Problem: Calculate the sum of first N natural numbers.
BEGIN
READ N
SET sum = 0
SET i = 1
WHILE i <= N DO
sum = sum + i
i = i + 1
ENDWHILE
PRINT sum
END
Trace for N = 4:
| i | sum |
|---|---|
| 1 | 1 |
| 2 | 3 |
| 3 | 6 |
| 4 | 10 |
Output: 10
Advantages of Pseudocode
- Easy to convert into actual code in any language
- Helps in detecting logical errors before coding
- Acts as documentation for the program
- Saves time during the actual programming phase
Conclusion
Pseudocode is a valuable tool in program design. It bridges the gap between problem understanding and actual implementation by expressing the algorithm in a simple, structured, and readable format.
System maintenance factors and maintainability
2080.2 · 5 marks
Explain different factors that influence maintainability of the information system. [5]
Software testing importance
0 · 5 marks
Why software testing in important? Explain any three software testing techniques. [5]
Make Unit 9 stick
Practice BIT253 with flashcards & quizzes