Exploring Programming Stage 6 Cambridge PPT
Exploring Programming Stage 6 Cambridge PPT
Aim
You will learn to:
•plan an algorithm to draw a simple repeating shape or pattern
•create a program to produce a simple repeating shape or pattern
•predict the output of a program that includes repetition
•plan an algorithm to draw a complex shape or pattern, using
decomposition
•create a procedure and use it in a program to draw a complex shape
or pattern.
•use the pen to draw lines and shapes
•change the colour and size of the pen.
Introduction to Algorithm
Objectives
● Understand Algorithm
● Defining an algorithm
● Writing Algorithms
Algorithm is...
● An effective method expressed as a finite list of
well-defined instructions in a sequential way to solve
problems.
Characteristics of an
Definiteness Finiteness
algorithm
Language
Effectiveness
Independent
Finiteness: The algorithm must always terminate after a finite number of steps.
Definiteness: Each step must be precisely defined; the actions to be carried out
must be rigorously and unambiguously specified for each case.
Input: An algorithm has zero or more inputs, taken from a specified set of
objects. Most algorithms require data values to define the specific problem.
Output: An algorithm has one or more outputs, which have a specified relation
to the inputs.
Effectiveness: All operations to be performed must be sufficiently basic that
they can be done exactly and in finite length.
Write an algorithm to bake the cake in Microwave
oven. Your algorithm should include all the required
information.
Addition of two numbers - Arrange instructions in order
Instructions Order
Instructions Order
No Before Yes
Take Bus Take Subway
7am?
Reach School
1. Start from home
2. Check time
3. If time is before 7am, take subway path to reach
school
4. Else, take school bus to reach school
Flowchart...
Number of Sides
360/Number of Sides
Flowchart to
draw Square
Operators Block
In IF-ELSE, the if block executes if the expression is true and if the expression is
false the control is passed to the else block.
What is the difference between REPEAT and
REPEAT-UNTIL command?
Which command will be used to ask input repeatedly till
the user enters correct value?
Use REPEAT-UNTIL
command in Control block
to ask repeatedly until the
user enters correct value.
What is Variable?
Variables are used to store information to be referenced
and manipulated in a computer program.
Variable Block
It gives the value of the variable.
Write a program to
draw Lollipop. Use
change pen size and use
different pen color for
each octagon.
Abstraction
Creating blocks/procedures is a part of the
Abstraction. Abstraction is an important part of
programming.