SlideShare a Scribd company logo
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Problem Solving and Design
Chapter: 09
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Learning Objectives
In this topic we will
learn about:
• computer systems
and sub-systems
• top-down design
• structure
diagrams
• flowcharts
• pseudocode
• library routines
• sub-routines
• algorithms
• standard methods
of solution
• test data
• validation and
verification
• using trace tables
• identifying and
correcting errors
• producing
algorithms
• the effectiveness
of a solution.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Introduction
• In order to build a computer system that performs a
specific task or solves a given problem, the task or
problem has to be clearly defined, showing what is
going to be computed and how it is going to be
computed.
• This topic introduces the tools and techniques that
are used to design a software solution that together
with the associated computer hardware will form a
computer system.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is a computer system?
• A computer system consists of software, data, hardware,
communications and people that have been carefully chosen so
that they work well together in order to build a computer system
that performs a specific task.
• HOT
• Do we have a system other than computer systems?
• Why we use system?
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What tools and techniques are used to
develop a system?
• Computer system is often divided up into sub-systems.
1. This division can be shown using top-down design to produce
structure diagrams that demonstrate the modular construction
of the system.
2. Each sub-system can be developed by a programmer as sub-
routine or an existing library routine may be already available
for use.
3. How each sub-routine works can be shown by using flowcharts or
pseudocode.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Top-down design
• It is the breaking down of a computer system into a set of
subsystems, then breaking each sub-system down into a set of
smaller sub-systems, until each sub-system just performs a single
action.
• This is an effective way of designing a computer system to provide
a solution to a problem, since each part of the problem is broken
down into smaller more manageable problems.
• The process of breaking down into smaller sub-systems is called
‘Stepwise Refinement’.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Structure diagrams
• The STRUCTURE DIAGRAM shows the design of a
computer system in a hierarchical way, with each level
giving a more detailed breakdown of the system into sub-
systems.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Real-life application
• Alarm app for a smart phone
• Consider the alarm app computer system for a smart phone.
• Creating the solution This involves:
1. top-down design or stepwise refinement
2. algorithms, which can be represented as
a. program flowcharts
b. pseudocode
• Using top-down design approach, this could be divided into three sub-systems,
• setting the alarm,
• checking for the alarm time,
• sounding the alarm.
• These sub-systems could then be further sub-divided; the structure diagram
makes the process clearer.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Real-life application
• Structure diagram for alarm app
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Activity
1. A school wants to calculate the number of hours spent in school
by a sample of students from time of arrival and departure data.
Draw a structure diagram and a program flowchart for an
algorithm with the following features:
2. Draw a structure diagram for cleaning your teeth.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Solution
• Calculating hours spent in
school
• Using top-down design approach,
this system could be divided into
three sub-systems,
• For each student, enter the
student’s name, the time of arrival
and the time of departure.
• Calculate the length of time each
student spends in school.
• Output the student’s name and the
time spent in school.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Flowcharts?
• A flowchart is a type of diagram that represents an algorithm,
workflow or process, showing the steps as boxes of various kinds,
and their order by connecting them with arrows. This
diagrammatic representation illustrates a solution model to a
given problem. OR
• A FLOWCHART shows diagrammatically the steps required for a
task (sub-system) and the order that they are to be performed.
These steps together with the order are called an ALGORITHM.
• Flowcharts are an effective way to communicate the algorithm
that shows how a system or sub-system works.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What are flowcharts symbols and their use?
Example
Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Pair Activity
• Write a flowchart program which input two numbers and output
the sum of these number
• Write a flowchart program to input physics and English marks and
output the total marks
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Critical Thinking - Pair Work
1. Write an algorithm in the form of a flowchart which takes
temperatures input over a 100 day period (once per day) and
outputs the number of days when the temperature was below
20C and the number of days when the temperature was 20C
and above.
2. Write an algorithm in the form of a flowchart which:
• inputs the top speeds (in km/hr) of 5000 cars
• outputs the fastest speed and the slowest speed
• outputs the average (mean) speed of all the 5000 cars
Sir Z@h!d Al!
+971-568047507
+92-3242415561
• Algorithm in the form of a flowchart
Critical Thinking - Pair Work
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is an algorithm?
• An algorithm is a self-contained sequence of
actions to be performed to solve a problem.
• Well-structured programs require a programming
language to support the following program
constructs:
• sequence
• selection
• iteration
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is pseudocode?
• Pseudocode is an informal high-level description
of the operating principle of a computer program
or other algorithm. It uses the structural
conventions of a normal programming language,
but is intended for human reading rather than
machine reading.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Understand and use pseudocode
• understand and use pseudocode for assignment, using ←
• understand and use pseudocode, using the following
commands and statements:
• INPUT and OUTPUT (e.g. READ and PRINT)
• totaling (e.g. Sum ← Sum + Number)
• counting (e.g. Count ← Count + 1)
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Understand and use pseudocode / algorithm
• understand and use pseudocode, using the following conditional
statements:
• IF … THEN … ELSE … ENDIF
• CASE … OF … OTHERWISE … ENDCASE
• understand and use pseudocode, using the following loop
structures:
• FOR … TO … NEXT
• REPEAT … UNTIL
• WHILE … DO … ENDWHILE
• (Candidates are advised to try out solutions to a variety of different
problems on a computer using a language of their choice; no
particular programming language will be assumed in this syllabus.)
Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Algorithm Vs Pseudocode Vs Program
• An algorithm is a well-defined procedure that allows a
computer to solve a problem.
• Pseudocode is a simple way of writing programming
code in simple language like English.
• A program is a sequence of instructions in a particular
programming language for instance QBASIC or C++,
written to perform a specified task on a computer.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Pair Activity
•Write a algorithm program which input
two numbers and output the sum of
these number
•Write a algorithm program to input
physics and English marks and output
the total marks
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Critical Thinking - Pair Work
1. Write an algorithm in the form of a pseudocode / flowchart
which takes temperatures input over a 100 day period (once
per day) and outputs the number of days when the
temperature was below 20C and the number of days when the
temperature was 20C and above.
2. Write an algorithm in the form of a pseudocode / flowchart
which:
• inputs the top speeds (in km/hr) of 5000 cars
• outputs the fastest speed and the slowest speed
• outputs the average (mean) speed of all the 5000 cars
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Library routines?
• A LIBRARY ROUTINE is a set of programming
instructions for a given task that is already
available for use.
• It is pre-tested and usually performs a task that is
frequently required.
• For example, the task „get time‟ in the checking-
for-the-alarm time algorithm would probably be
readily available as a library routine.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Sub-routines?
•A SUB-ROUTINE is a set of programming
instructions for a given task that forms a
subsystem, not the whole system.
•Sub-routines written in high-level
programming languages are called
„procedures‟ or „functions‟ depending on
how they are used.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Test Data? Why it is important ?
• Test data is the data that is used in tests of a program or system.
• In order to test a program we need to enter some data for testing
most of the features. Any such specifically identified data which
is used in tests is known as test data.
• There are following three types of test data:
• 1. Normal Data
• 2. Extreme Data
• 3. Abnormal Data
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Difference between Normal, Extreme and
Abnormal Data
Test Case Explanation
Example where a
score should be
between 0 and 50
Normal
Data that you would expect to work
or be accepted and that lies within
the range
2, 45
Extreme
Data at the lower and upper limits of
the range
0, 50
Abnormal
Data that should not be accepted by
the program
-7, 51, Ahmed
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Rogue Values?
• A value of input which is used to halt / break to
repetitive statement. OR
• A sequence of inputs may continue until a
specific value is arrived / input. This value is
called a rogue value and must be a value which
would not normally arise.
• A rogue value lets the computer know that a
sequence of input values has come to an end.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Pair Work Activity
• A number of marks are to be input (terminated by a rogue value of
-1). How many of them are over 50?
• Counter = 0
• INPUT Marks
• REPEAT
• IF Marks >50 THEN counter = counter +1
• INPUT Marks
• UNTIL Marks=-1
• OUTPUT counter
Sir Z@h!d Al!
+971-568047507
+92-3242415561
How readable is your code?
• Often programmers will work on each other's code. So you need to
write your code so that it can be read and understood by others.
You also need to be able to understand it if you come back to it
months or years later. There are a few techniques you can use to
help with this:
• Internal commentary
• Meaningful identifiers (variable names)
• Indentation
• White Space
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What kind of test data would be used to find out if
a program works under regular circumstances?
a) Normal
b) Extreme
c) Exceptional
Sir Z@h!d Al!
+971-568047507
+92-3242415561
How to make sure that there is no error in
the data?
• Data verification and data validation are two
methods of making sure no errors occur in the
data before processing takes place. (Make sure
you know the difference between them!)
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Data Verification?
• Typing data into a computer from a data capture form is called
transcribing. If an error is made it is a transcription error.
• Verification is done to eliminate transcription errors.
• Methods of verification...
Proof
reading
A visual check by eye that no errors have been made. This is
sometimes done by printing out data that has been input, and
sending it back to the source of the data to check. For example,
printed proofs of the pages of a book may be sent back to the author
for checking.
Double-
keying
This is a check to see if data has been keyed in correctly. The data is
keyed in twice, and the computer will only accept the data for
processing if the two versions are identical.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Validation?
• Validation is the automated checking by a program
that data is reasonable before it is accepted into a
computer system. Different types of check may be
used on the same piece of data;
• A check to see if data is 'valid' before it is processed
that it is sensible data.
• There are a number of different data validation
checks which can be carried out. Following are some
of them:
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Types of Validations
Validation type How it works Example usage
Check digit the last one or two digits in a code are
used to check the other digits are
correct
bar code readers in supermarkets use check
digits
Format check checks the data is in the right format a National Insurance number is in the form LL
99 99 99 L where L is any letter and 9 is any
number
Length check checks the data isn't too short or too
long
a password which needs to be eight letters
long
Lookup table looks up acceptable values in a table there are only seven possible days of the week
Presence check checks that data has been entered into
a field
in most databases a key fieldcannot be left
blank
Range check checks that a value falls within the
specified range
number of hours worked must be less than 50
and more than 0
Spell check looks up words in a dictionary when word processing
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Challenge!!! Individual work
• Write an pseudocode for range check.
• Draw the flow chart for the range check.
• Write an pseudocode for presence check.
• Draw the flow chart for the presence check.
• Write an pseudocode for length check.
• Draw the flow chart for the length check.
• Try same for other varification and validation checks like double
keying etc.

More Related Content

PPTX
Introduction to Programming Languages
PPSX
Problem solving and design
PDF
Pseudocode By ZAK
PPTX
Basic programming concepts
PPT
Visual Basic Programming
PPTX
Pascal Programming Language
PDF
Lecture 4 principles of parallel algorithm design updated
PPTX
Number System in CoMpUtEr
Introduction to Programming Languages
Problem solving and design
Pseudocode By ZAK
Basic programming concepts
Visual Basic Programming
Pascal Programming Language
Lecture 4 principles of parallel algorithm design updated
Number System in CoMpUtEr

What's hot (20)

PPTX
Uses of Computers
PPTX
MS Dos command
PDF
1 - Unit 1 - Hardware.pdf
PPTX
Presentation Introduction to Windows
PPT
Binary code - Beginning
PPT
Computer architecture pipelining
PPTX
Language processor
PPTX
Programming Fundamentals lecture 1
DOCX
1st assignment introduction to computer
PPT
Intro To Programming Concepts
PPTX
Number System
PPTX
Pseudocode
PPT
3 algorithm-and-flowchart
PDF
The pseudocode
PPTX
Introduction to Coding
PPT
Computer programming concepts
PPTX
Types of Operating System
PPT
how to start and shut down a computer.ppt
PPTX
EE5440 – Computer Architecture - Lecture 2
PPT
Files and Folders
Uses of Computers
MS Dos command
1 - Unit 1 - Hardware.pdf
Presentation Introduction to Windows
Binary code - Beginning
Computer architecture pipelining
Language processor
Programming Fundamentals lecture 1
1st assignment introduction to computer
Intro To Programming Concepts
Number System
Pseudocode
3 algorithm-and-flowchart
The pseudocode
Introduction to Coding
Computer programming concepts
Types of Operating System
how to start and shut down a computer.ppt
EE5440 – Computer Architecture - Lecture 2
Files and Folders
Ad

Similar to Problem solving and design (20)

PPTX
Problem-solving and design 1.pptx
PDF
2 problem solving and programming workbook by inqilab patel
PPTX
2.1.1 PROBLEM SOLVING & DESIGN
PPTX
Flowchart and algorithm
PPT
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
PPTX
Data Structures_Introduction to algorithms.pptx
PDF
IGCSE & O Level Computer Workbook for P2 by Inqilab Patel
PPTX
vingautosaved-230525024624-6a6fb3b2.pptx
PPTX
Algorithm Design and Problem Solving [Autosaved].pptx
PPSX
Algorithm and flowchart
PDF
Algorithm.pdf
PPT
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
PPT
Program design techniques
PPTX
UNIT-1.pptx python for engineering first year students
PPT
Csc 130 class 2 problem analysis and flow charts(2)
PPT
Best Techniques To Design Programs - Program Designing Techniques
PDF
problem solving and design By ZAK
PDF
Fundamental of Information Technology - UNIT 6
PPTX
1. Problem Solving Techniques and Data Structures.pptx
PPT
Itc lec5-24+sep+2012
Problem-solving and design 1.pptx
2 problem solving and programming workbook by inqilab patel
2.1.1 PROBLEM SOLVING & DESIGN
Flowchart and algorithm
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Data Structures_Introduction to algorithms.pptx
IGCSE & O Level Computer Workbook for P2 by Inqilab Patel
vingautosaved-230525024624-6a6fb3b2.pptx
Algorithm Design and Problem Solving [Autosaved].pptx
Algorithm and flowchart
Algorithm.pdf
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Program design techniques
UNIT-1.pptx python for engineering first year students
Csc 130 class 2 problem analysis and flow charts(2)
Best Techniques To Design Programs - Program Designing Techniques
problem solving and design By ZAK
Fundamental of Information Technology - UNIT 6
1. Problem Solving Techniques and Data Structures.pptx
Itc lec5-24+sep+2012
Ad

Recently uploaded (20)

PDF
IGGE1 Understanding the Self1234567891011
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
Computing-Curriculum for Schools in Ghana
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
Unit 4 Skeletal System.ppt.pptxopresentatiom
PDF
Complications of Minimal Access Surgery at WLH
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Empowerment Technology for Senior High School Guide
PPTX
Cell Types and Its function , kingdom of life
PDF
Supply Chain Operations Speaking Notes -ICLT Program
IGGE1 Understanding the Self1234567891011
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Indian roads congress 037 - 2012 Flexible pavement
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Computing-Curriculum for Schools in Ghana
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Chinmaya Tiranga quiz Grand Finale.pdf
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Final Presentation General Medicine 03-08-2024.pptx
Paper A Mock Exam 9_ Attempt review.pdf.
Unit 4 Skeletal System.ppt.pptxopresentatiom
Complications of Minimal Access Surgery at WLH
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Empowerment Technology for Senior High School Guide
Cell Types and Its function , kingdom of life
Supply Chain Operations Speaking Notes -ICLT Program

Problem solving and design

  • 2. Sir Z@h!d Al! +971-568047507 +92-3242415561 Learning Objectives In this topic we will learn about: • computer systems and sub-systems • top-down design • structure diagrams • flowcharts • pseudocode • library routines • sub-routines • algorithms • standard methods of solution • test data • validation and verification • using trace tables • identifying and correcting errors • producing algorithms • the effectiveness of a solution.
  • 3. Sir Z@h!d Al! +971-568047507 +92-3242415561 Introduction • In order to build a computer system that performs a specific task or solves a given problem, the task or problem has to be clearly defined, showing what is going to be computed and how it is going to be computed. • This topic introduces the tools and techniques that are used to design a software solution that together with the associated computer hardware will form a computer system.
  • 5. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is a computer system? • A computer system consists of software, data, hardware, communications and people that have been carefully chosen so that they work well together in order to build a computer system that performs a specific task. • HOT • Do we have a system other than computer systems? • Why we use system?
  • 6. Sir Z@h!d Al! +971-568047507 +92-3242415561 What tools and techniques are used to develop a system? • Computer system is often divided up into sub-systems. 1. This division can be shown using top-down design to produce structure diagrams that demonstrate the modular construction of the system. 2. Each sub-system can be developed by a programmer as sub- routine or an existing library routine may be already available for use. 3. How each sub-routine works can be shown by using flowcharts or pseudocode.
  • 7. Sir Z@h!d Al! +971-568047507 +92-3242415561 Top-down design • It is the breaking down of a computer system into a set of subsystems, then breaking each sub-system down into a set of smaller sub-systems, until each sub-system just performs a single action. • This is an effective way of designing a computer system to provide a solution to a problem, since each part of the problem is broken down into smaller more manageable problems. • The process of breaking down into smaller sub-systems is called ‘Stepwise Refinement’.
  • 8. Sir Z@h!d Al! +971-568047507 +92-3242415561 Structure diagrams • The STRUCTURE DIAGRAM shows the design of a computer system in a hierarchical way, with each level giving a more detailed breakdown of the system into sub- systems.
  • 9. Sir Z@h!d Al! +971-568047507 +92-3242415561 Real-life application • Alarm app for a smart phone • Consider the alarm app computer system for a smart phone. • Creating the solution This involves: 1. top-down design or stepwise refinement 2. algorithms, which can be represented as a. program flowcharts b. pseudocode • Using top-down design approach, this could be divided into three sub-systems, • setting the alarm, • checking for the alarm time, • sounding the alarm. • These sub-systems could then be further sub-divided; the structure diagram makes the process clearer.
  • 10. Sir Z@h!d Al! +971-568047507 +92-3242415561 Real-life application • Structure diagram for alarm app
  • 11. Sir Z@h!d Al! +971-568047507 +92-3242415561 Activity 1. A school wants to calculate the number of hours spent in school by a sample of students from time of arrival and departure data. Draw a structure diagram and a program flowchart for an algorithm with the following features: 2. Draw a structure diagram for cleaning your teeth.
  • 12. Sir Z@h!d Al! +971-568047507 +92-3242415561 Solution • Calculating hours spent in school • Using top-down design approach, this system could be divided into three sub-systems, • For each student, enter the student’s name, the time of arrival and the time of departure. • Calculate the length of time each student spends in school. • Output the student’s name and the time spent in school.
  • 13. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Flowcharts? • A flowchart is a type of diagram that represents an algorithm, workflow or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows. This diagrammatic representation illustrates a solution model to a given problem. OR • A FLOWCHART shows diagrammatically the steps required for a task (sub-system) and the order that they are to be performed. These steps together with the order are called an ALGORITHM. • Flowcharts are an effective way to communicate the algorithm that shows how a system or sub-system works.
  • 14. Sir Z@h!d Al! +971-568047507 +92-3242415561 What are flowcharts symbols and their use? Example
  • 15. Sir Z@h!d Al! +971-568047507 +92-3242415561 HOTS - Pair Activity • Write a flowchart program which input two numbers and output the sum of these number • Write a flowchart program to input physics and English marks and output the total marks
  • 16. Sir Z@h!d Al! +971-568047507 +92-3242415561 Critical Thinking - Pair Work 1. Write an algorithm in the form of a flowchart which takes temperatures input over a 100 day period (once per day) and outputs the number of days when the temperature was below 20C and the number of days when the temperature was 20C and above. 2. Write an algorithm in the form of a flowchart which: • inputs the top speeds (in km/hr) of 5000 cars • outputs the fastest speed and the slowest speed • outputs the average (mean) speed of all the 5000 cars
  • 17. Sir Z@h!d Al! +971-568047507 +92-3242415561 • Algorithm in the form of a flowchart Critical Thinking - Pair Work
  • 18. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is an algorithm? • An algorithm is a self-contained sequence of actions to be performed to solve a problem. • Well-structured programs require a programming language to support the following program constructs: • sequence • selection • iteration
  • 19. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is pseudocode? • Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a normal programming language, but is intended for human reading rather than machine reading.
  • 20. Sir Z@h!d Al! +971-568047507 +92-3242415561 Understand and use pseudocode • understand and use pseudocode for assignment, using ← • understand and use pseudocode, using the following commands and statements: • INPUT and OUTPUT (e.g. READ and PRINT) • totaling (e.g. Sum ← Sum + Number) • counting (e.g. Count ← Count + 1)
  • 21. Sir Z@h!d Al! +971-568047507 +92-3242415561 Understand and use pseudocode / algorithm • understand and use pseudocode, using the following conditional statements: • IF … THEN … ELSE … ENDIF • CASE … OF … OTHERWISE … ENDCASE • understand and use pseudocode, using the following loop structures: • FOR … TO … NEXT • REPEAT … UNTIL • WHILE … DO … ENDWHILE • (Candidates are advised to try out solutions to a variety of different problems on a computer using a language of their choice; no particular programming language will be assumed in this syllabus.)
  • 22. Sir Z@h!d Al! +971-568047507 +92-3242415561 HOTS - Algorithm Vs Pseudocode Vs Program • An algorithm is a well-defined procedure that allows a computer to solve a problem. • Pseudocode is a simple way of writing programming code in simple language like English. • A program is a sequence of instructions in a particular programming language for instance QBASIC or C++, written to perform a specified task on a computer.
  • 23. Sir Z@h!d Al! +971-568047507 +92-3242415561 HOTS - Pair Activity •Write a algorithm program which input two numbers and output the sum of these number •Write a algorithm program to input physics and English marks and output the total marks
  • 24. Sir Z@h!d Al! +971-568047507 +92-3242415561 Critical Thinking - Pair Work 1. Write an algorithm in the form of a pseudocode / flowchart which takes temperatures input over a 100 day period (once per day) and outputs the number of days when the temperature was below 20C and the number of days when the temperature was 20C and above. 2. Write an algorithm in the form of a pseudocode / flowchart which: • inputs the top speeds (in km/hr) of 5000 cars • outputs the fastest speed and the slowest speed • outputs the average (mean) speed of all the 5000 cars
  • 25. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Library routines? • A LIBRARY ROUTINE is a set of programming instructions for a given task that is already available for use. • It is pre-tested and usually performs a task that is frequently required. • For example, the task „get time‟ in the checking- for-the-alarm time algorithm would probably be readily available as a library routine.
  • 26. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Sub-routines? •A SUB-ROUTINE is a set of programming instructions for a given task that forms a subsystem, not the whole system. •Sub-routines written in high-level programming languages are called „procedures‟ or „functions‟ depending on how they are used.
  • 27. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Test Data? Why it is important ? • Test data is the data that is used in tests of a program or system. • In order to test a program we need to enter some data for testing most of the features. Any such specifically identified data which is used in tests is known as test data. • There are following three types of test data: • 1. Normal Data • 2. Extreme Data • 3. Abnormal Data
  • 28. Sir Z@h!d Al! +971-568047507 +92-3242415561 Difference between Normal, Extreme and Abnormal Data Test Case Explanation Example where a score should be between 0 and 50 Normal Data that you would expect to work or be accepted and that lies within the range 2, 45 Extreme Data at the lower and upper limits of the range 0, 50 Abnormal Data that should not be accepted by the program -7, 51, Ahmed
  • 29. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Rogue Values? • A value of input which is used to halt / break to repetitive statement. OR • A sequence of inputs may continue until a specific value is arrived / input. This value is called a rogue value and must be a value which would not normally arise. • A rogue value lets the computer know that a sequence of input values has come to an end.
  • 30. Sir Z@h!d Al! +971-568047507 +92-3242415561 Pair Work Activity • A number of marks are to be input (terminated by a rogue value of -1). How many of them are over 50? • Counter = 0 • INPUT Marks • REPEAT • IF Marks >50 THEN counter = counter +1 • INPUT Marks • UNTIL Marks=-1 • OUTPUT counter
  • 31. Sir Z@h!d Al! +971-568047507 +92-3242415561 How readable is your code? • Often programmers will work on each other's code. So you need to write your code so that it can be read and understood by others. You also need to be able to understand it if you come back to it months or years later. There are a few techniques you can use to help with this: • Internal commentary • Meaningful identifiers (variable names) • Indentation • White Space
  • 32. Sir Z@h!d Al! +971-568047507 +92-3242415561 What kind of test data would be used to find out if a program works under regular circumstances? a) Normal b) Extreme c) Exceptional
  • 33. Sir Z@h!d Al! +971-568047507 +92-3242415561 How to make sure that there is no error in the data? • Data verification and data validation are two methods of making sure no errors occur in the data before processing takes place. (Make sure you know the difference between them!)
  • 34. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Data Verification? • Typing data into a computer from a data capture form is called transcribing. If an error is made it is a transcription error. • Verification is done to eliminate transcription errors. • Methods of verification... Proof reading A visual check by eye that no errors have been made. This is sometimes done by printing out data that has been input, and sending it back to the source of the data to check. For example, printed proofs of the pages of a book may be sent back to the author for checking. Double- keying This is a check to see if data has been keyed in correctly. The data is keyed in twice, and the computer will only accept the data for processing if the two versions are identical.
  • 35. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Validation? • Validation is the automated checking by a program that data is reasonable before it is accepted into a computer system. Different types of check may be used on the same piece of data; • A check to see if data is 'valid' before it is processed that it is sensible data. • There are a number of different data validation checks which can be carried out. Following are some of them:
  • 36. Sir Z@h!d Al! +971-568047507 +92-3242415561 Types of Validations Validation type How it works Example usage Check digit the last one or two digits in a code are used to check the other digits are correct bar code readers in supermarkets use check digits Format check checks the data is in the right format a National Insurance number is in the form LL 99 99 99 L where L is any letter and 9 is any number Length check checks the data isn't too short or too long a password which needs to be eight letters long Lookup table looks up acceptable values in a table there are only seven possible days of the week Presence check checks that data has been entered into a field in most databases a key fieldcannot be left blank Range check checks that a value falls within the specified range number of hours worked must be less than 50 and more than 0 Spell check looks up words in a dictionary when word processing
  • 37. Sir Z@h!d Al! +971-568047507 +92-3242415561 Challenge!!! Individual work • Write an pseudocode for range check. • Draw the flow chart for the range check. • Write an pseudocode for presence check. • Draw the flow chart for the presence check. • Write an pseudocode for length check. • Draw the flow chart for the length check. • Try same for other varification and validation checks like double keying etc.