Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views3 pages

Algorithms With Comparison Anskey

The document outlines an assignment for Grade 5 students at Merryland International School focusing on algorithms and conditional statements. It includes exercises on identifying conditions and outcomes based on 'If...Then' statements, as well as filling in blanks for given algorithms. The document also presents an algorithm for a night light that incorporates random number generation and conditional actions based on the generated number.

Uploaded by

j97qjsbxbc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Algorithms With Comparison Anskey

The document outlines an assignment for Grade 5 students at Merryland International School focusing on algorithms and conditional statements. It includes exercises on identifying conditions and outcomes based on 'If...Then' statements, as well as filling in blanks for given algorithms. The document also presents an algorithm for a night light that incorporates random number generation and conditional actions based on the generated number.

Uploaded by

j97qjsbxbc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Term 3 MERRYLAND INTERNATIONAL SCHOOL

CAMBRIDGE COMPUTING
Theory DEPARTMENT OF ICT
GRADE 5 (2024-2025)
Algorithms with selection and Predict Outcome-Task 3
NAME: ______________________GRADE & SEC: _____________DATE: ________________
I. Look at the following If…Then statements. Identify the following.

• The condition
• The outcome when the condition is true
• The outcome when the condition is false.
a. If the weather is cold outside, then I will wear a sweater, else I will wear a T-shirt.
b. If the traffic light is red, then stop the vehicle, else continue driving.
c. If it is raining, then do not water the plants, else go and water the plants.
d. If I have exams tomorrow, then I will study, else I will go outside to play.
e. If my pet is dirty, then I will give him bath, else I will not bath him.

If… Then… Else…


Outcome if condition is:
Condition
True False
a If the weather is cold wear a sweater wear a T-shirt
outside

b If the traffic light is red stop the vehicle continue driving

c If it is raining do not water the plants water the plants

d If I have exams I will study I will go outside to play


tomorrow

e
If my pet is dirty I will give him a bath he does not need a
bath
II. From the Algorithm, identify

• The condition
• The outcome when the condition is true
• The outcome when the condition is false

Algorithm

Step Instruction

1 Start when simulator is started

2 Clear screen

3.1 If Button B is pressed, then Condition


3.1.1 Show string ‘Goodbye!’
3 Outcome when
3.2 Else the condition is
true
3.2.1 Show string “Press B
Outcome when the
4 Repeat steps 2 and 3 forever condition is false

5 Stop Program

III. Fill in the blanks of the algorithm using the following information.

Algorithm begins when the simulator is started. It indefinitely checks to see if the condition is met

The condition is: The micro: bit is shaken.

If condition is true: The giggle sound is played until it is done

If condition is false: the happy icon will be shown on the screen.


Algorithm

Step Instruction

1 the simulator is started


Start program when______________________________

2.1 If __________________________________,
the micro:bit is shaken then

play the giggle sound until it is done


2.1.1 _____________________________________

2.2 Else

2 show the happy icon on the screen


2.2.1______________________________________

3 2
Repeat step ________________________ forever

4 Stop program

IV. Algorithm for a night light.

Algorithm

Step Instruction

1 Start program when Button A is pressed

2 Create Variable called Light

Set Light to randomly pick a whole number


3 From 0 to 5

4.1 If Light=5, then

4.1.1 Show all LEDs lighting

4.2 Else

4 4.2.1 Clear screen

5 Stop program

You might also like