SlideShare a Scribd company logo
UNIT 2.1.1 – PROBLEM SOLVING & DESIGN
• show understanding that every computer system is made up of sub-systems, which in turn are
made up of further sub-systems
• use top-down design, structure diagrams, flowcharts, pseudocode, library routines and subroutines
• work out the purpose of a given algorithm
• explain standard methods of solution
• suggest and apply suitable test data
• understand the need for validation and verification checks to be made on input data (validation
could include range checks, length checks, type checks and check digits)
• use trace tables to find the value of variables at each step in an algorithm
• identify errors in given algorithms and suggest ways of removing these errors
• produce an algorithm for a given problem (either in the form of pseudocode or flowchart)
• comment on the effectiveness of a given solution
What is a computer system?
A COMPUTER SYSTEM is made up of software, data, hardware,
communications and persware (the people who drive and run the
information system).
TOP-DOWN DESIGN is the breaking down of a computer system into a set of
sub- systems, then breaking each sub-system down into a set of smaller
sub-systems, until each sub-system just performs a single action. Each part
of the problem is broken down into smaller more manageable problems.
Stepwise refinement is the process of breaking down a complex system into
smaller sub-systems.
SUB-ROUTINE: It is a sequence of steps, part of a larger computer program.
Sub-routines written in high-level programming languages are called
‘procedures’ or ‘functions’ depending on how they are used.
PROGRAM LIBRARY / SUB-ROUTINE LIBRARY: It is a collection of standard
programs (subroutine, procedure, function etc), often designed to handle
commonly occurring problems or tasks that are stored. It is pretested and
usually performs a task that is frequently required.
Library routines are stored in a program library and given names. This
allows them to be called into immediate use when needed, even from other
programs. Using library routines make writing programs faster and easier
as part of the work has already been done (and debugged).
 BENEFITS OF MODULAR PROGRAMMING
 Modules can be easily tested and debugged (debug: remove errors from program)
 Modules can be prewritten and reused.
 Several programmers can work on separate modules.
 It is easier to make changes to module without updating the entire program.
 DRAWBACKS OF MODULAR PROGRAMMING
 There should be proper planning of each module.
 Additional testing must be done when linking the different module.
 Testing and debugging of separate modules may prove to be time consuming.
 TOOLS AND TECHNIQUES - There are different tools and techniques for modular programming: Structure chart,
flowchart and pseudocode. These techniques can be used to break down a complex problem and refine it to a sub-
system.
 A top-down design approach can be used to produce structure diagrams that demonstrate the modular construction
the system. Each sub-system can be developed by a programmer as sub-routine or an existing library of routine may
already available for use.
 STRUCTURE DIAGRAM - It shows the hierarchy or structure of the different components or modules of the system and
shows how they connect and interact with each other. It visualises how a system works from the initial input, to
processing and, finally, to the desired output.
STRUCTURE DIAGRAM EXAMPLE 1
Divide sum
by 10
Calculate sum
of 10
numbers
Program average of 10
numbers
Input 10 numbers Calculate average Print average
THIS IS THE END OF
CHAPTER 2.1.1- PROBLEM SOLVING &
DESIGN
IT IS DIFFICULT TO EXPLAIN
EVERYTHING. IT TOOK ME ALMOST 2
MONTHS TO EXPLAIN.
THERE ARE SO MANY EXERCISES TO
PRACTICE BUT UNFORNATELY CANNOT
ADD AS IT WILL BE TOO LENGTHY
STRUCTURE DIAGRAM EXAMPLE 2
Read payroll
record
Validate
payroll record
Calculate
deductions
Calculate
gross pay
Update
employee
record
Generate payroll
Get payroll record Calculate net pay Print payroll
STRUCTURE DIAGRAM EXAMPLE 3
 PSEUDOCODE uses English-like words and mathematical operators that are set out to look like a
program.

 FLOWCHART - a diagrammatic representation of an algorithm or process showing boxes representing
steps and arrows connecting the boxes, showing the flow of data. It is an effective way to
the algorithm that shows how a system or sub-system works.

 ALGORITHM – It is a set of steps for solving a problem in terms of actions to be executed. This is
usually shown as a flowchart or pseudocode. Put it simply, the sequence of steps taken to solve a
problem, for example a recipe.
 An algorithm expects a defined set of inputs, for example entering a series of marks in a computer
science exam.
 It produces a define set of outputs, for example the number of passes and failures.
 It terminates and produces a result always stopping after a finite loop. (a rogue value to stop the loop).
 Most algorithms are guaranteed to produce the correct result.
TEST DATA
TEST DATA – A system should be thoroughly tested before
implementation. Computer programs can be tested using test data by
running them on a computer using any data that is required and seeing
what result is output. Test data is the data that is used in tests of a
software system. In order to test a software application, we need to enter
some data for testing most of the features.
NORMAL DATA
 NORMAL DATA (ACCEPTABLE/VALID) – A system needs to be working
correctly. Normal test data will accept the data being tested to prove that
the solution works correctly. A set of normal test data should be used
together with the result(s) that are expected from that data.
 Example: days of the month should be any value between 1 and 31 or
students marks in a test may be between 0 and 100.
 A set of normal test data could be: 3,11,25,30 for days of the month.
ABNORMAL TEST DATA
ABNORMAL OR ERRONEOUS TEST DATA. This type of test data will
indicate the user that there is a problem. It will usually be rejected as
they are not appropriate and an error message displayed. Testing,
needs to be done to prove that the solution does not give incorrect
results.
Example: negative numbers for days of the month or students marks
in a test.
 A set of abnormal test data could be: -5, 0, P,35 for days of
month.
EXTREME & BOUNDARY DATA
 EXTREME/ LIMIT DATA - Extreme data are the largest and the smallest values that the system can
take and will be accepted.
 Example: percentage marks should only be 0 (lowest possible value} and 100 (highest possible value}.
 BOUNDARY DATA – Tests are performed using the boundary values and is used to establish where
the largest and smallest values occur. At each boundary two values are required, one value is
and the other value is rejected.
 Example: In an exam the pass boundary is at 50 percent, merit at 75 percent and distinction at 85
percent. The Valid Boundary values for this situation will be as follows:
49, 50 - for pass
74, 75 - for merit
84, 85 - for distinction
 Boundary values are validated against both the valid boundaries and invalid boundaries.
 A SET OF TEST DATA is all the items of data required to work through a solution.
 For example {-5, 0, 1, 20, 31, 50} can be used to test dates for a month.
VALIDATION AND VERIFICATION - In order for computer systems to only accept
data inputs that are reasonable and accurate, every item of data needs to be
examined before it is accepted by the system.
 VALIDATION
 It is the automated checking by a program that data is reasonable before it is
accepted into a computer system (performed automatically by a computer
program). Different types of check may be used on the same piece of data; for
example, an examination mark could be checked for reasonableness by using a
range check, a type check and a presence check. When data is validated by a
computer system, if the data is rejected a message should be output explaining
why the data was rejected and another opportunity given to enter the data.
VALIDATION & VERIFICATION
THERE ARE MANY DIFFERENT TYPES OF
VALIDATION CHECKS INCLUDING:
1. RANGE CHECK checks that the values lie within a specified range are accepted.
For example, days of the month should be between 1 and 31 inclusive or
percentage marks between 0 and 100 inclusive.
2. LENGTH CHECK (Check the correct length is entered) - Checks the data
isn't too short or too long. values must be a specific length.
Checks either:
• data contains an exact number of characters. Example: a password must be
exactly eight characters in length else, rejected. OR
• data entered is a reasonable number of characters, for example a family
name could be between 2 and 30 characters inclusive so that names with
one character or 31 or more characters would be rejected.
3. TYPE CHECK checks that the data entered is of a given data type, for example
integer or real number.
4. CHARACTER CHECK checks that when a string of characters is entered it does not
contain any invalid characters or symbols, for example a name would contain letters
only and a telephone number would only contain digits.
5. FORMAT CHECK checks that the characters entered conform to a pre-defined
pattern, for example date of the year is in the format DD/MM/YY.
6. PRESENCE CHECK checks to ensure that some data has been entered and the value
has not been left blank, for example an email address must be given for an online
transaction or key field is not left blank
7. CHECK DIGIT is the final digit included in a code; it is calculated from all the
other digits in the code. Check digits are used for barcodes, product codes,
International Standard Book Numbers (ISBN) and Vehicle Identification Numbers
(VIN).
Check digits are used to identify errors in data entry caused by mis-typing or mis-
scanning a barcode.
They can usually detect the following types of error:
• incorrect digit entered, for example 5327 entered instead of 5307
• transposition errors where two numbers have changed order, for example
5037 instead of 5307
• omitted or extra digits, for example 537 instead of 5307 or 53107 instead of
5307
• phonetic errors, for example 13, thirteen, instead of 30, thirty.
VERIFICATION
 VERIFICATION - Verification is performed to ensure that the data entered exactly matches the
original source. Verification means checking the input data with the original data to make sure that
there have been no transcription errors (transcription means copying the data from one source to
another).
 It is used to check that the data does not change as it is being entered. It involves a human as the
computer cannot do this by itself.

 Verification methods include:
 Double entry - to input data twice to the computer system. For example, entering password twice
during sign-up
 Screen/visual check – it involves checking visually the data that has been input. The user may be
asked to confirm that it is correct before continuing
 Proof reading – data entered is checked against the original, generally a person specially trained for
this.
 Parity check
 Checksum
TRACE TABLE
It is a technique used to test algorithms, to ensure that no logical
errors occur whilst the algorithm is being processed. The table is made
up of multiple rows and columns. The trace table is used to show any
changes to key variables or key expressions after each line in the
program has been "executed". Each column showing a variable and
any output, and each row showing each number input into the
algorithm and the subsequent values of the variables.
C-temp F_temp Output
DRY RUN
 Dry running a program involves the programmer working through a program
on paper, usually using a table called a ‘trace table’. The programmer adds
columns for any variables or expressions that are important. When this has
been done, the programmer works through the program, line by line, filling
into the trace table the values of variables and expressions as they change. By
doing this, the programmer can spot the exact position when things start going
wrong with the program - when variables suddenly contain unexpected values
or expressions don't hold the expected state.
STAGES IN PRODUCING ALGORITHMS
 An algorithm is a set of step by step plan to solve a computer-related problem and is
similar to a recipe.

 Obtain a description of the problem and make sure that the problem is clearly specified.
 Break the problem down into sub-problems;
 Identify the input (what need to be input in the system and how is it going to be obtained)
 Identify the processing (A process is an action that is carried out). {calculate, sort, locate,
search, etc..}
 Output of results. (what to display/print etc.…)
 To construct algorithm, should a flowchart or pseudocode be used.
 Step by step test using several sets of test data and trace tables to find any errors.
 Identify the different constant, variable and loop to be used.
 If any errors are found, repeat the process until you think that your algorithm works
perfectly.
 The algorithm should be understandable and clear. use meaningful names for any data
stores.
 Refine the algorithm by adding more details if needed.

THE EFFECTIVENESS OF A SOLUTION
 It is a measure of how good the results of the algorithm produced are, as there
are many different solutions to the same problem.
 Does it do what it is supposed to do?
 Does the solution work for all sets of data? (Normal/ abnormal/ boundary)
 There should be no ambiguity. Each step should be clearly and precisely defined.
 Can the algorithm be simplified?
 Does the solution have any unnecessary processes that are never used?
 Are any actions repeated more often than necessary?

EXAMPLE 1: AN ALGORITHM TO CONVERT A TEMPERATURE
FROM DEGREES CENTIGRADE TO DEGREES FAHRENHEIT.
FLOWCHART PSEUDOCODE TRACE TABLE
Input C_temp
F_temp := (1.8 * C_temp) + 32
Output F_temp
C-temp F_temp Output
EXAMPLE 1: AN ALGORITHM TO CONVERT A TEMPERATURE
FROM DEGREES CENTIGRADE TO DEGREES FAHRENHEIT.
FLOWCHART PSEUDOCODE TRACE TABLE
Input C_temp
F_temp := (1.8 * C_temp) + 32
Output F_temp
C-temp F_temp Output
ERRORS IN PSEUDOCODE
Always check that:
IF NUM < SMALL THEN SMALL = NUM; IF NUM > LARGE THEN LARGE = NUM; IF
X>Y THEN Y = X.
Output is always outside the loop.
Small = 1000 (a large number).
Count = count + 1.
There is no counter in repeat loop.
Total = total + num (if num is input) and average = total/ counter.
Check initialized value against counter
Check =, >, <, <=, >=, ><etc
SOME PAST EXAM QUESTIONS
AND ANSWERS ON THIS
CHAPTER
PROBLEM SOLVING &DESIGN
Study the flowchart very carefully. [JUN 09/P1/14]
Study the flowchart. [NOV09/P1/9]
[NOV 10/P13/11]
Study the following flowchart very carefully: [JUN 10/P11/5]
The following flowchart inputs ten temperatures and outputs the average (mean) temperature and the number of
temperatures which were negative (i.e. < 0). [JUN 11/P12/10]
Carefully study the following flowchart: [JUN 12/P12/6]
NOV 06/P1/9 - A computer program is required which inputs 10 numbers, multiplies them together and
finally outputs the answer (the product). The following algorithm has been written to do this.
JUN 10/P11/12 - A golf course charges $10 for each game of two people. Each additional person incurs a
further charge of $2 per game. If they book two or more games in advance, they get a 10% discount on the
total charge. The following program has been written in pseudocode to calculate the charges for a game.
[NOV 10/P11 & 12/9] - The following algorithm inputs 20 numbers and outputs how many
numbers were positive (> 0) and how many numbers were negative (< 0).
JUN 10/P12/7 - (a) Read the following section of code that inputs twenty (20) numbers and
then outputs the largest number input.

More Related Content

What's hot

Algorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to AlgorithmsAlgorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to Algorithms
Mohamed Loey
 
Relationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & PatternRelationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & Pattern
Bharat Rathore
 
Compiler Design
Compiler DesignCompiler Design
Compiler DesignMir Majid
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
Dr. C.V. Suresh Babu
 
Flowcharts and pseudocodes
Flowcharts and pseudocodesFlowcharts and pseudocodes
Flowcharts and pseudocodes
Dr Piyush Charan
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
Akhil Kaushik
 
Artificial Intelligence Notes Unit 1
Artificial Intelligence Notes Unit 1 Artificial Intelligence Notes Unit 1
Artificial Intelligence Notes Unit 1
DigiGurukul
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Yıldırım Tam
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
Deva Singh
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1
Namrah Erum
 
Theory of Computation
Theory of ComputationTheory of Computation
Theory of Computation
Shiraz316
 
Software Engineering (Project Planning & Estimation)
Software Engineering (Project Planning &  Estimation)Software Engineering (Project Planning &  Estimation)
Software Engineering (Project Planning & Estimation)
ShudipPal
 
Programming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f cProgramming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f cRaja Hamid
 
Artificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge AcquisitionArtificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge Acquisition
The Integral Worm
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)
Adam Mukharil Bachtiar
 
LL(1) parsing
LL(1) parsingLL(1) parsing
LL(1) parsing
KHYATI PATEL
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
Dr Geetha Mohan
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
MAHASREEM
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compilerAbha Damani
 
Software Process Models
Software Process ModelsSoftware Process Models
Software Process Models
Hassan A-j
 

What's hot (20)

Algorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to AlgorithmsAlgorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to Algorithms
 
Relationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & PatternRelationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & Pattern
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Flowcharts and pseudocodes
Flowcharts and pseudocodesFlowcharts and pseudocodes
Flowcharts and pseudocodes
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Artificial Intelligence Notes Unit 1
Artificial Intelligence Notes Unit 1 Artificial Intelligence Notes Unit 1
Artificial Intelligence Notes Unit 1
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1
 
Theory of Computation
Theory of ComputationTheory of Computation
Theory of Computation
 
Software Engineering (Project Planning & Estimation)
Software Engineering (Project Planning &  Estimation)Software Engineering (Project Planning &  Estimation)
Software Engineering (Project Planning & Estimation)
 
Programming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f cProgramming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f c
 
Artificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge AcquisitionArtificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge Acquisition
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)
 
LL(1) parsing
LL(1) parsingLL(1) parsing
LL(1) parsing
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Software Process Models
Software Process ModelsSoftware Process Models
Software Process Models
 

Similar to 2.1.1 PROBLEM SOLVING & DESIGN

Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
TadiwaMawere
 
System Integration and Architecture.pptx
System Integration and Architecture.pptxSystem Integration and Architecture.pptx
System Integration and Architecture.pptx
MARIVICJOYCLAMUCHA1
 
Software Risk Analysis
Software Risk AnalysisSoftware Risk Analysis
Software Risk Analysis
Brett Leonard
 
pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
vishnupriyapm4
 
Test data documentation ss
Test data documentation ssTest data documentation ss
Test data documentation ssAshwiniPoloju
 
Chapter 8 system analysis and design
Chapter 8   system analysis and designChapter 8   system analysis and design
Chapter 8 system analysis and designPratik Gupta
 
System testing
System testingSystem testing
System testing
Sifat Hossain
 
Cse
CseCse
Introduction to testing.
Introduction to testing.Introduction to testing.
Introduction to testing.
Jithinctzz
 
Generating Test Cases
Generating Test CasesGenerating Test Cases
Generating Test Cases
VivekRajawat9
 
Sdd Testing & Evaluating
Sdd Testing & EvaluatingSdd Testing & Evaluating
Sdd Testing & Evaluatingmary_ramsay
 
Testcase training
Testcase trainingTestcase training
Testcase trainingmedsherb
 
Testing 2 - Thinking Like A Tester
Testing 2 - Thinking Like A TesterTesting 2 - Thinking Like A Tester
Testing 2 - Thinking Like A Tester
ArleneAndrews2
 
Systems development cycle
Systems development cycleSystems development cycle
Systems development cycle
Samuel Igbanogu
 
Cse115 lecture03problemsolving
Cse115 lecture03problemsolvingCse115 lecture03problemsolving
Cse115 lecture03problemsolving
Md. Ashikur Rahman
 
testing
testingtesting
testing
Rashmi Deoli
 
UNIT 4.pptx
UNIT 4.pptxUNIT 4.pptx
UNIT 4.pptx
SreeLatha98
 
Chapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineeringChapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineering
AnasHassan52
 
part 1 - intorduction data structure 2021 mte.ppt
part 1 -  intorduction data structure  2021 mte.pptpart 1 -  intorduction data structure  2021 mte.ppt
part 1 - intorduction data structure 2021 mte.ppt
abdoSelem1
 

Similar to 2.1.1 PROBLEM SOLVING & DESIGN (20)

Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
 
System Integration and Architecture.pptx
System Integration and Architecture.pptxSystem Integration and Architecture.pptx
System Integration and Architecture.pptx
 
Software Risk Analysis
Software Risk AnalysisSoftware Risk Analysis
Software Risk Analysis
 
pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
 
Test data documentation ss
Test data documentation ssTest data documentation ss
Test data documentation ss
 
Chapter 8 system analysis and design
Chapter 8   system analysis and designChapter 8   system analysis and design
Chapter 8 system analysis and design
 
System testing
System testingSystem testing
System testing
 
Cse
CseCse
Cse
 
Introduction to testing.
Introduction to testing.Introduction to testing.
Introduction to testing.
 
Generating Test Cases
Generating Test CasesGenerating Test Cases
Generating Test Cases
 
Sdd Testing & Evaluating
Sdd Testing & EvaluatingSdd Testing & Evaluating
Sdd Testing & Evaluating
 
Testcase training
Testcase trainingTestcase training
Testcase training
 
Testing 2 - Thinking Like A Tester
Testing 2 - Thinking Like A TesterTesting 2 - Thinking Like A Tester
Testing 2 - Thinking Like A Tester
 
Systems development cycle
Systems development cycleSystems development cycle
Systems development cycle
 
Cse115 lecture03problemsolving
Cse115 lecture03problemsolvingCse115 lecture03problemsolving
Cse115 lecture03problemsolving
 
testing
testingtesting
testing
 
L software testing
L   software testingL   software testing
L software testing
 
UNIT 4.pptx
UNIT 4.pptxUNIT 4.pptx
UNIT 4.pptx
 
Chapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineeringChapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineering
 
part 1 - intorduction data structure 2021 mte.ppt
part 1 -  intorduction data structure  2021 mte.pptpart 1 -  intorduction data structure  2021 mte.ppt
part 1 - intorduction data structure 2021 mte.ppt
 

More from Buxoo Abdullah

1.1.2 HEXADECIMAL
1.1.2 HEXADECIMAL1.1.2 HEXADECIMAL
1.1.2 HEXADECIMAL
Buxoo Abdullah
 
MONEY & BANKING
MONEY & BANKINGMONEY & BANKING
MONEY & BANKING
Buxoo Abdullah
 
Retail trade
Retail tradeRetail trade
Retail trade
Buxoo Abdullah
 
1.1.3 DATA STORAGE
1.1.3 DATA STORAGE1.1.3 DATA STORAGE
1.1.3 DATA STORAGE
Buxoo Abdullah
 
CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1
Buxoo Abdullah
 
1.1.1 BINARY SYSTEM
1.1.1 BINARY SYSTEM1.1.1 BINARY SYSTEM
1.1.1 BINARY SYSTEM
Buxoo Abdullah
 
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
COMPUTER SCIENCE PRE RELEASE  2210 FOR NOVEMBER 2018 P22COMPUTER SCIENCE PRE RELEASE  2210 FOR NOVEMBER 2018 P22
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
Buxoo Abdullah
 
Computer health & safety issues
Computer health & safety issuesComputer health & safety issues
Computer health & safety issues
Buxoo Abdullah
 
Program & language generation
Program & language generationProgram & language generation
Program & language generation
Buxoo Abdullah
 
Data and information
Data and informationData and information
Data and information
Buxoo Abdullah
 
Computer languages
Computer languagesComputer languages
Computer languages
Buxoo Abdullah
 
Input devices
Input devicesInput devices
Input devices
Buxoo Abdullah
 
Formative & summative evaluation
Formative & summative evaluationFormative & summative evaluation
Formative & summative evaluation
Buxoo Abdullah
 
Ppt presentation of queues
Ppt presentation of queuesPpt presentation of queues
Ppt presentation of queues
Buxoo Abdullah
 

More from Buxoo Abdullah (14)

1.1.2 HEXADECIMAL
1.1.2 HEXADECIMAL1.1.2 HEXADECIMAL
1.1.2 HEXADECIMAL
 
MONEY & BANKING
MONEY & BANKINGMONEY & BANKING
MONEY & BANKING
 
Retail trade
Retail tradeRetail trade
Retail trade
 
1.1.3 DATA STORAGE
1.1.3 DATA STORAGE1.1.3 DATA STORAGE
1.1.3 DATA STORAGE
 
CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1
 
1.1.1 BINARY SYSTEM
1.1.1 BINARY SYSTEM1.1.1 BINARY SYSTEM
1.1.1 BINARY SYSTEM
 
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
COMPUTER SCIENCE PRE RELEASE  2210 FOR NOVEMBER 2018 P22COMPUTER SCIENCE PRE RELEASE  2210 FOR NOVEMBER 2018 P22
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
 
Computer health & safety issues
Computer health & safety issuesComputer health & safety issues
Computer health & safety issues
 
Program & language generation
Program & language generationProgram & language generation
Program & language generation
 
Data and information
Data and informationData and information
Data and information
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Input devices
Input devicesInput devices
Input devices
 
Formative & summative evaluation
Formative & summative evaluationFormative & summative evaluation
Formative & summative evaluation
 
Ppt presentation of queues
Ppt presentation of queuesPpt presentation of queues
Ppt presentation of queues
 

Recently uploaded

Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 

Recently uploaded (20)

Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 

2.1.1 PROBLEM SOLVING & DESIGN

  • 1. UNIT 2.1.1 – PROBLEM SOLVING & DESIGN • show understanding that every computer system is made up of sub-systems, which in turn are made up of further sub-systems • use top-down design, structure diagrams, flowcharts, pseudocode, library routines and subroutines • work out the purpose of a given algorithm • explain standard methods of solution • suggest and apply suitable test data • understand the need for validation and verification checks to be made on input data (validation could include range checks, length checks, type checks and check digits) • use trace tables to find the value of variables at each step in an algorithm • identify errors in given algorithms and suggest ways of removing these errors • produce an algorithm for a given problem (either in the form of pseudocode or flowchart) • comment on the effectiveness of a given solution
  • 2. What is a computer system? A COMPUTER SYSTEM is made up of software, data, hardware, communications and persware (the people who drive and run the information system). TOP-DOWN DESIGN is the breaking down of a computer system into a set of sub- systems, then breaking each sub-system down into a set of smaller sub-systems, until each sub-system just performs a single action. Each part of the problem is broken down into smaller more manageable problems. Stepwise refinement is the process of breaking down a complex system into smaller sub-systems. SUB-ROUTINE: It is a sequence of steps, part of a larger computer program. Sub-routines written in high-level programming languages are called ‘procedures’ or ‘functions’ depending on how they are used. PROGRAM LIBRARY / SUB-ROUTINE LIBRARY: It is a collection of standard programs (subroutine, procedure, function etc), often designed to handle commonly occurring problems or tasks that are stored. It is pretested and usually performs a task that is frequently required. Library routines are stored in a program library and given names. This allows them to be called into immediate use when needed, even from other programs. Using library routines make writing programs faster and easier as part of the work has already been done (and debugged).
  • 3.  BENEFITS OF MODULAR PROGRAMMING  Modules can be easily tested and debugged (debug: remove errors from program)  Modules can be prewritten and reused.  Several programmers can work on separate modules.  It is easier to make changes to module without updating the entire program.  DRAWBACKS OF MODULAR PROGRAMMING  There should be proper planning of each module.  Additional testing must be done when linking the different module.  Testing and debugging of separate modules may prove to be time consuming.  TOOLS AND TECHNIQUES - There are different tools and techniques for modular programming: Structure chart, flowchart and pseudocode. These techniques can be used to break down a complex problem and refine it to a sub- system.  A top-down design approach can be used to produce structure diagrams that demonstrate the modular construction the system. Each sub-system can be developed by a programmer as sub-routine or an existing library of routine may already available for use.  STRUCTURE DIAGRAM - It shows the hierarchy or structure of the different components or modules of the system and shows how they connect and interact with each other. It visualises how a system works from the initial input, to processing and, finally, to the desired output.
  • 4. STRUCTURE DIAGRAM EXAMPLE 1 Divide sum by 10 Calculate sum of 10 numbers Program average of 10 numbers Input 10 numbers Calculate average Print average
  • 5. THIS IS THE END OF CHAPTER 2.1.1- PROBLEM SOLVING & DESIGN IT IS DIFFICULT TO EXPLAIN EVERYTHING. IT TOOK ME ALMOST 2 MONTHS TO EXPLAIN. THERE ARE SO MANY EXERCISES TO PRACTICE BUT UNFORNATELY CANNOT ADD AS IT WILL BE TOO LENGTHY
  • 6. STRUCTURE DIAGRAM EXAMPLE 2 Read payroll record Validate payroll record Calculate deductions Calculate gross pay Update employee record Generate payroll Get payroll record Calculate net pay Print payroll
  • 8.  PSEUDOCODE uses English-like words and mathematical operators that are set out to look like a program.   FLOWCHART - a diagrammatic representation of an algorithm or process showing boxes representing steps and arrows connecting the boxes, showing the flow of data. It is an effective way to the algorithm that shows how a system or sub-system works.   ALGORITHM – It is a set of steps for solving a problem in terms of actions to be executed. This is usually shown as a flowchart or pseudocode. Put it simply, the sequence of steps taken to solve a problem, for example a recipe.  An algorithm expects a defined set of inputs, for example entering a series of marks in a computer science exam.  It produces a define set of outputs, for example the number of passes and failures.  It terminates and produces a result always stopping after a finite loop. (a rogue value to stop the loop).  Most algorithms are guaranteed to produce the correct result.
  • 9. TEST DATA TEST DATA – A system should be thoroughly tested before implementation. Computer programs can be tested using test data by running them on a computer using any data that is required and seeing what result is output. Test data is the data that is used in tests of a software system. In order to test a software application, we need to enter some data for testing most of the features.
  • 10. NORMAL DATA  NORMAL DATA (ACCEPTABLE/VALID) – A system needs to be working correctly. Normal test data will accept the data being tested to prove that the solution works correctly. A set of normal test data should be used together with the result(s) that are expected from that data.  Example: days of the month should be any value between 1 and 31 or students marks in a test may be between 0 and 100.  A set of normal test data could be: 3,11,25,30 for days of the month.
  • 11. ABNORMAL TEST DATA ABNORMAL OR ERRONEOUS TEST DATA. This type of test data will indicate the user that there is a problem. It will usually be rejected as they are not appropriate and an error message displayed. Testing, needs to be done to prove that the solution does not give incorrect results. Example: negative numbers for days of the month or students marks in a test.  A set of abnormal test data could be: -5, 0, P,35 for days of month.
  • 12. EXTREME & BOUNDARY DATA  EXTREME/ LIMIT DATA - Extreme data are the largest and the smallest values that the system can take and will be accepted.  Example: percentage marks should only be 0 (lowest possible value} and 100 (highest possible value}.  BOUNDARY DATA – Tests are performed using the boundary values and is used to establish where the largest and smallest values occur. At each boundary two values are required, one value is and the other value is rejected.  Example: In an exam the pass boundary is at 50 percent, merit at 75 percent and distinction at 85 percent. The Valid Boundary values for this situation will be as follows: 49, 50 - for pass 74, 75 - for merit 84, 85 - for distinction  Boundary values are validated against both the valid boundaries and invalid boundaries.  A SET OF TEST DATA is all the items of data required to work through a solution.  For example {-5, 0, 1, 20, 31, 50} can be used to test dates for a month.
  • 13. VALIDATION AND VERIFICATION - In order for computer systems to only accept data inputs that are reasonable and accurate, every item of data needs to be examined before it is accepted by the system.  VALIDATION  It is the automated checking by a program that data is reasonable before it is accepted into a computer system (performed automatically by a computer program). Different types of check may be used on the same piece of data; for example, an examination mark could be checked for reasonableness by using a range check, a type check and a presence check. When data is validated by a computer system, if the data is rejected a message should be output explaining why the data was rejected and another opportunity given to enter the data. VALIDATION & VERIFICATION
  • 14. THERE ARE MANY DIFFERENT TYPES OF VALIDATION CHECKS INCLUDING: 1. RANGE CHECK checks that the values lie within a specified range are accepted. For example, days of the month should be between 1 and 31 inclusive or percentage marks between 0 and 100 inclusive. 2. LENGTH CHECK (Check the correct length is entered) - Checks the data isn't too short or too long. values must be a specific length. Checks either: • data contains an exact number of characters. Example: a password must be exactly eight characters in length else, rejected. OR • data entered is a reasonable number of characters, for example a family name could be between 2 and 30 characters inclusive so that names with one character or 31 or more characters would be rejected.
  • 15. 3. TYPE CHECK checks that the data entered is of a given data type, for example integer or real number. 4. CHARACTER CHECK checks that when a string of characters is entered it does not contain any invalid characters or symbols, for example a name would contain letters only and a telephone number would only contain digits. 5. FORMAT CHECK checks that the characters entered conform to a pre-defined pattern, for example date of the year is in the format DD/MM/YY. 6. PRESENCE CHECK checks to ensure that some data has been entered and the value has not been left blank, for example an email address must be given for an online transaction or key field is not left blank
  • 16. 7. CHECK DIGIT is the final digit included in a code; it is calculated from all the other digits in the code. Check digits are used for barcodes, product codes, International Standard Book Numbers (ISBN) and Vehicle Identification Numbers (VIN). Check digits are used to identify errors in data entry caused by mis-typing or mis- scanning a barcode. They can usually detect the following types of error: • incorrect digit entered, for example 5327 entered instead of 5307 • transposition errors where two numbers have changed order, for example 5037 instead of 5307 • omitted or extra digits, for example 537 instead of 5307 or 53107 instead of 5307 • phonetic errors, for example 13, thirteen, instead of 30, thirty.
  • 17. VERIFICATION  VERIFICATION - Verification is performed to ensure that the data entered exactly matches the original source. Verification means checking the input data with the original data to make sure that there have been no transcription errors (transcription means copying the data from one source to another).  It is used to check that the data does not change as it is being entered. It involves a human as the computer cannot do this by itself.   Verification methods include:  Double entry - to input data twice to the computer system. For example, entering password twice during sign-up  Screen/visual check – it involves checking visually the data that has been input. The user may be asked to confirm that it is correct before continuing  Proof reading – data entered is checked against the original, generally a person specially trained for this.  Parity check  Checksum
  • 18. TRACE TABLE It is a technique used to test algorithms, to ensure that no logical errors occur whilst the algorithm is being processed. The table is made up of multiple rows and columns. The trace table is used to show any changes to key variables or key expressions after each line in the program has been "executed". Each column showing a variable and any output, and each row showing each number input into the algorithm and the subsequent values of the variables. C-temp F_temp Output
  • 19. DRY RUN  Dry running a program involves the programmer working through a program on paper, usually using a table called a ‘trace table’. The programmer adds columns for any variables or expressions that are important. When this has been done, the programmer works through the program, line by line, filling into the trace table the values of variables and expressions as they change. By doing this, the programmer can spot the exact position when things start going wrong with the program - when variables suddenly contain unexpected values or expressions don't hold the expected state.
  • 20. STAGES IN PRODUCING ALGORITHMS  An algorithm is a set of step by step plan to solve a computer-related problem and is similar to a recipe.   Obtain a description of the problem and make sure that the problem is clearly specified.  Break the problem down into sub-problems;  Identify the input (what need to be input in the system and how is it going to be obtained)  Identify the processing (A process is an action that is carried out). {calculate, sort, locate, search, etc..}  Output of results. (what to display/print etc.…)  To construct algorithm, should a flowchart or pseudocode be used.  Step by step test using several sets of test data and trace tables to find any errors.  Identify the different constant, variable and loop to be used.  If any errors are found, repeat the process until you think that your algorithm works perfectly.  The algorithm should be understandable and clear. use meaningful names for any data stores.  Refine the algorithm by adding more details if needed. 
  • 21. THE EFFECTIVENESS OF A SOLUTION  It is a measure of how good the results of the algorithm produced are, as there are many different solutions to the same problem.  Does it do what it is supposed to do?  Does the solution work for all sets of data? (Normal/ abnormal/ boundary)  There should be no ambiguity. Each step should be clearly and precisely defined.  Can the algorithm be simplified?  Does the solution have any unnecessary processes that are never used?  Are any actions repeated more often than necessary? 
  • 22. EXAMPLE 1: AN ALGORITHM TO CONVERT A TEMPERATURE FROM DEGREES CENTIGRADE TO DEGREES FAHRENHEIT. FLOWCHART PSEUDOCODE TRACE TABLE Input C_temp F_temp := (1.8 * C_temp) + 32 Output F_temp C-temp F_temp Output
  • 23. EXAMPLE 1: AN ALGORITHM TO CONVERT A TEMPERATURE FROM DEGREES CENTIGRADE TO DEGREES FAHRENHEIT. FLOWCHART PSEUDOCODE TRACE TABLE Input C_temp F_temp := (1.8 * C_temp) + 32 Output F_temp C-temp F_temp Output
  • 24. ERRORS IN PSEUDOCODE Always check that: IF NUM < SMALL THEN SMALL = NUM; IF NUM > LARGE THEN LARGE = NUM; IF X>Y THEN Y = X. Output is always outside the loop. Small = 1000 (a large number). Count = count + 1. There is no counter in repeat loop. Total = total + num (if num is input) and average = total/ counter. Check initialized value against counter Check =, >, <, <=, >=, ><etc
  • 25. SOME PAST EXAM QUESTIONS AND ANSWERS ON THIS CHAPTER PROBLEM SOLVING &DESIGN
  • 26. Study the flowchart very carefully. [JUN 09/P1/14]
  • 27. Study the flowchart. [NOV09/P1/9]
  • 29. Study the following flowchart very carefully: [JUN 10/P11/5]
  • 30. The following flowchart inputs ten temperatures and outputs the average (mean) temperature and the number of temperatures which were negative (i.e. < 0). [JUN 11/P12/10]
  • 31. Carefully study the following flowchart: [JUN 12/P12/6]
  • 32. NOV 06/P1/9 - A computer program is required which inputs 10 numbers, multiplies them together and finally outputs the answer (the product). The following algorithm has been written to do this.
  • 33. JUN 10/P11/12 - A golf course charges $10 for each game of two people. Each additional person incurs a further charge of $2 per game. If they book two or more games in advance, they get a 10% discount on the total charge. The following program has been written in pseudocode to calculate the charges for a game.
  • 34. [NOV 10/P11 & 12/9] - The following algorithm inputs 20 numbers and outputs how many numbers were positive (> 0) and how many numbers were negative (< 0).
  • 35. JUN 10/P12/7 - (a) Read the following section of code that inputs twenty (20) numbers and then outputs the largest number input.