27
Review. Test 4
Textbook: pp. 72–73
GoalReview Chapter 4: flowchart shapes, linear and branching algorithms.
New words
review · takrorlashlinear · chiziqlicondition block · shart blokito check · tekshirmoq
Explanation
Let us recall: an oval is start and end, a rectangle is an action, a diamond is a condition, an arrow is order. If actions are one after another it is a linear algorithm (no diamond). If it depends on a condition it is a branching algorithm (there is a diamond). To check an algorithm we try it out with an example.
Worked examples
Algorithm: if the number is greater than 5, write “big”, otherwise write “small”. For 8: “big”; for 3: “small”; for 5: also “small”.
“Brushing teeth” is a linear algorithm, “What to wear?” is a branching algorithm.
Class activity
“Which algorithm?”: the teacher names an algorithm (washing hands, crossing the road, making tea, dressing for the weather). Children show “linear” (arms in a straight line) or “branching” (arms in a “Y” shape).
Practice
1
Algorithm: if the number is greater than 5 — “big”, otherwise — “small”. What is the answer for 5?
small (5 is not greater than 5)
2
Crossing the road at a traffic light is which kind of algorithm: linear or branching?
branching (it depends on the colour of the light)
3
Inside which shape is a condition written?
a diamond