Year 8TechnologiesSupport
Trace each algorithm one step at a time, keeping track of every variable. Write the exact output. MOD gives the remainder after dividing (7 MOD 2 = 1).
AFlowchart basics
Look at the shapes and the arrows.
- 1.
Match each flowchart shape to what it shows.
4 marks- oval
- rectangle
- diamond
- parallelogram
- Aa process (do something)
- Ba decision (yes or no question)
- Cinput or output
- Dstart or end
- 2.
Use the flowchart. The temperature input is 34. What is the output?
1 mark - 3.
Use the same flowchart. The temperature input is exactly 30. What is the output?
1 mark- Have a good day
- Wear a hat and drink water
- Nothing is output
- 4.
A decision in an algorithm can send the program down two different paths.
1 mark- True
- False
BTrace the pseudocode
Keep track of each variable as it changes.
- 5.
What is the output? x = 5 IF x MOD 2 = 0 THEN OUTPUT "even" ELSE OUTPUT "odd" ENDIF
1 mark - 6.
Worked example: x = 1, then x = x + 2 makes x equal 3. Now trace this. What is the output? score = 4 score = score + 6 score = score - 3 OUTPUT score
1 mark - 7.
What is the output? Fill in total after each loop. total = 0 FOR i = 1 TO 4 total = total + i NEXT i OUTPUT total
2 marks - 8.
This algorithm should output the larger of two numbers, but it has a bug. What is the bug? INPUT a INPUT b IF a > b THEN OUTPUT b ELSE OUTPUT a ENDIF
1 mark- It outputs the smaller number instead of the larger one.
- It never outputs anything.
- It only works when a and b are equal.