ICT - Block 2
ICT - Block 2
ICT - Block 2
2. Design - The team work out the details of the program by breaking it down into smaller chunks.
This includes thinking about the visual appearance and the programming behind the software. The
team will use pseudocode and diagrams to work out how the program should go.
3. Implementation - The Program Code is written. Good Pseudocode allows the implementation
stage to be relatively easy. The code is normally written in a high-level language.
4. Testing - This involves testing the program under various conditions to make sure it is going to
work. You need to think about what devices it could be used on and what might cause the
program to crash.
5. Evolution - The software is ready to be launched, but after it has been launched you will need to
think about how the software evolves. Software needs to be maintained to ensure it works on new
systems.
Page 1 of 17
Algorithm
It refers to a set of rules/instructions that step-by-step define how a work is to be done in order to get
the expected results.
Here’s an Example:
Let us have a look at a typical student morning. We will look at how we approach our morning as a
series of different individual tasks.
Go to School Wake Up
Algorithm
Step 1: Wake up
Step 2: Get out of bed
Step 3: Have breakfast Get out of bed Get out of bed
Step 4: Go to school
Wake Up Go to School
The order in which we do each task is very important. If we get the order around the wrong way,
the tasks will not make sense.
Page 2 of 17
Flowchart “F.g. 2.1” shows more information, so this means it’s better and more informative, more
than Flowchart “F.g. 1.1”.
Before you write an algorithm, it’s important to check that the problem is completely understood.
There are a number of basic things you need to know in order to really understand the problem:
Once these basic things are understood, it is time to design the algorithm
Page 3 of 17
Flowchart
A flowchart is a picture (graphical representation) of an algorithm or the problem-solving process, it
gives a step – by – step procedure for a solution of a problem and it’s a formal plan for planning.
Page 4 of 17
Flowchart symbols and their purpose:
Page 5 of 17
PseudoCode
Pseudocode is kind of structured English for describing the steps needed to solve a programming
task. It allows the designer to focus on the logic without being distracted by details of the
programming language.
There is no strict set of standard notations for pseudocode, but some of the most widely recognised are:
6 IF – THEN – ELSE – a decision (selection) in which a choice is made any instructions that
occur inside a selection or iteration are usually indented.
Pseudocode can be used to plan out programs. Planning a program that asks people what the best
subject they take is
Page 6 of 17
What is the difference between Constant and Variable?
Constant:
Is a value in computer programming that does not change when the program is running.
Is a location in memory that holds a value that cannot be changed as the program runs like π .
Variable:
Is a symbol or name that stands for a value. Program instructions may cause the value to change.
A named storage location containing a value that can change, depending on conditions during the
program’s execution
Example of PseudoCode:
REPEAT
OUTPUT 'What is the best subject you take?'
INPUT user inputs the best subject he takes
STORE the user's input in the answer variable
IF answer = 'Computer Science' THEN
OUTPUT 'Of course it is!'
ELSE
OUTPUT 'Try again!'
UNTIL answer = “Science”
Page 7 of 17
Structured Programming
Structured programming is a program written with only the structured programming constructions:
(1) Sequence:
This means that the computer will run your code in order, one line at a time from the top to the bottom
of your program. It will start at line 1, then execute line 2 then line 3 and so on till it reaches the last
line of your program.
Page 8 of 17
(3) Selection / Branch / Condition / Decision:
Sometimes you only want some lines of code to be run only if a condition is met, otherwise you want
the computer to ignore these lines and jump over them. This is achieved using IF statements.
Page 9 of 17
Converting Between Algorithms, PseudoCodes and Flowcharts
=Step 1: Start
Step 2: Read A
Step 3: Read B
Step 4: Calculate Total = A + B
Step 5: Print Total
Step 6: Stop
INPUT A
INPUT B
Add A and B INTO Total
OUTPUT Total
__________________________________________________________________________________
Task (2):
Page 10 of 17
Week 1 – Unit 2 – Studysheet 2
Logo
Computers can be used to control many types of devices like robots. Robots need to be programmed
with instructions to tell them what to do and these need to be written in languages like Logo
Logo is a Simple Computer programming language which can be used to control devices. For
example, a small robot known as a turtle can be moved around the floor using logo. Logo is often used
with a screen turtle, which is an object on the screen used to simulate how a turtle moves around the
floor. There are many commands which can be used to control the turtle
LOGO Commands
Here are some examples of the most common Logo commands: (n / t = any value)
Command Function / Action
FORWARD n move forward n steps
BACKWARD n move backward n steps
LEFT t turn t° left
RIGHT t turn t° right
PENDOWN lower pen and begin drawing
PENUP raise pen and cease drawing
REPEAT n
Commands between these lines should be repeated n times
END REPEAT
Page 11 of 17
Repeating commands
The same commands can be written more quickly using the REPEAT command, for example:
1. REPEAT 4
2. FORWARD 100
3. LEFT 90
4. END REPEAT
These above commands would have the same effect as the eight individual commands above - it draws
a square
The REPEAT command can be used to create any number of patterns. For example, a shape similar to
a Spirograph was created with these commands:
1. REPEAT 30
2. FORWARD 100
3. RIGHT 156
4. END REPEAT
Storing a series of commands like this creates a simple program. The order of the commands in a
program is vital. If it is in the wrong order, the program will not work as expected.
Computer programming languages are very fussy. Any errors, however small, will cause the program
not to work. The computer won't like spelling mistakes or, for example, if you forget to put a space
between FORWARD and 50.
Page 12 of 17
Example (1):
1 PENDOWN
2 FORWARD 60
3 RIGHT 90
4 FORWARD 60
5 RIGHT 90
6 FORWARD 30
7 RIGHT 90
8 FORWARD 30
9 LEFT 90
10 FORWARD 30
11 RIGHT 90
12 FORWARD 30
Example (2):
This Shape has two solutions:
Page 13 of 17
Example (3):
1 PENDOWN
2 FORWARD 40
3 RIGHT 90
4 FORWARD 20
5 PEN UP
6 FORWARD 10
7 PENDOWN
8 FORWARD 20
9 RIGHT 90
10 FORWARD 40
11 RIGHT 90
12 FORWARD 20
13 PEN UP
14 FORWARD 10
15 PENDOWN
16 FORWARD 20
Page 14 of 17
Week 2 – Studysheet 1 - Unit 2
All programs use one or more of these constructs. The longer and more complex the program, the
more these constructs will be used repeatedly.
Page 15 of 17
1st let’s talk about Sequence:
Sequence is the first programming construct. In programming, instructions are executed one after
another. Sequence is the order in which the instructions are executed.
The sequence of instructions is extremely important as carrying out instructions in the wrong order
results in a program performing incorrectly.
Example of sequence:
1. Create a basic and Simple Calculator
Flowchart Design
Start
Get Number 1
Get Number 2
Total = Number 1
+ Number 2
Display Total
End
Scratch Script Blocks
Page 16 of 17