Chapter 7
Chapter 7
Problem Solving
By Amna Javed
Program Development Life Cycle
Program Development Life Cycle
• Before solving a problem, it is essential to define and document the problem clearly,
known as the "requirements specification" for the program.
• The analysis stage involves using tools like abstraction and decomposition to
identify the specific requirements for the program.
• Abstraction focuses on the essential elements needed for the solution while
eliminating unnecessary details and information.
• Decomposition involves breaking down complex problems into smaller, more
manageable parts that can be solved individually.
• Daily tasks can be decomposed into constituent parts for easier understanding and
solving
Design
• Assignment statement:
• Each variable is assigned using a left arrow.
• [VARIABLE NAME] <---- [Value to be assigned]
Activity 7.3
Pseudo code
Activity 7.6
Standard Methods of Solution
1. Totalling:
2. Counting
3. Max, Min, & Avg
4. Linear Search
5. Bubble Sort
Validation
• Test data refers to input values used to evaluate and assess the
functionality and performance of a computer program or system.
• It helps identify errors and assess how the program handles different
scenarios
• There are four types of Data Sets:
1. Normal Data
2. Abnormal Data
3. Extreme Data
4. Boundary Data
Test Data
Normal Data:
• Normal data is the test data which accepts values in acceptible range
of values of the program
• Normal data should be used to work through the solution to find the
actual result(s) and see if they are the same as the expected result(s)
• e.g. in a program where only whole number values ranging from 0 to
100 (inclusive) are accepted, normal test data will be : 23, 54, 64 , 2
and 100
Test Data
Abnormal Data:
• Test data that would be rejected by the solution as not
suitable, if the solution is working properly is called abnormal
test data / erroneous test data.
• e.g. in a program where only whole number values ranging
from 0 to 100 (inclusive) are accepted, abnormal data will be:
-1, 151, 200, 67.2, “Sixty-Two” and -520
Test Data
Extreme Data:
• Extreme data are the largest and smallest values that normal
data can take
• e.g. in a program where only whole number values ranging
from 0 to 100 (inclusive) are accepted, extreme data will be:
0 and 100
Test Data
Boundary Data:
• This is used to establish where the largest and smallest values occur
• At each boundary two values are required: one value is accepted
and the other value is rejected.
• e.g. in a program where only whole number values ranging from 0 to
100 (inclusive) are accepted, one example of boundary data will be:
100 and 101. 100 will be accepted and 101 will not be accepted
Trace Tables