Computational Thinking: Unit Exam A
Instructions
- Time allowed
- 25 minutes
- Total marks
- 25
- Calculator
- No calculator is permitted.
- Answer all the questions.
Questions
| Decomposition | Abstraction | Pattern recognition | Algorithm design | |
|---|---|---|---|---|
| Breaking a big problem into smaller problems | ||||
| Removing details that are not needed | ||||
| Spotting what is the same in different problems | ||||
| Writing the steps that solve the problem |
Tick one box in each row.
- LBreaking a big problem into smaller problems: Decomposition
- LRemoving details that are not needed: Abstraction
- LSpotting what is the same in different problems: Pattern recognition
- LWriting the steps that solve the problem: Algorithm design
Decomposition breaks down, abstraction removes detail, pattern recognition spots similarities and algorithm design writes the steps.
Tick one box.
- LD Abstraction
The map keeps only what a passenger needs, the order of stations and the lines, so it is abstraction.
| Start or end | Process | Decision | Input or output | |
|---|---|---|---|---|
| Rounded rectangle | ||||
| Rectangle | ||||
| Diamond | ||||
| Parallelogram |
Tick one box in each row.
- LRounded rectangle: Start or end
- LRectangle: Process
- LDiamond: Decision
- LParallelogram: Input or output
Rounded rectangle for start and end, rectangle for a process, diamond for a decision and parallelogram for input or output.
Tick one box.
- LB 2
A decision has two exits, one for yes and one for no.
total = 0
for i = 1 to 4
total = total + i
next i
print(total)| i | total |
|---|---|
| 1 | |
| 2 | |
| 3 | |
| 4 |
- L1
- L3
- L6
- L10
total goes 0 + 1 = 1, then 1 + 2 = 3, then 3 + 3 = 6, then 6 + 4 = 10.
- L10
After the loop total is 10, which is printed.
| Normal | Boundary | Erroneous | |
|---|---|---|---|
| 13 | |||
| 16 | |||
| abc | |||
| 11 |
Tick one box in each row.
- L13: Normal
- L16: Boundary
- Labc: Erroneous
- L11: Boundary
13 is an ordinary valid value, 11 and 16 are at the edges of the range, and abc is the wrong type of data.
Tick one box.
- LC A way of writing an algorithm in structured English that looks like code but is not a real language
Pseudocode sets out the logic without worrying about any one language's rules.
- LSmaller problems are easier to understand and solve
- LParts can be shared out, worked on separately and tested on their own
Breaking a game into parts, such as the player, the enemies, the scoring and the menu, turns one overwhelming problem into small ones that are each easy to solve. The parts can also be shared out within a team and tested separately.
age = input("Age: ")
if age >= 12 then
print("Allowed")
else
print("Too young")
endif- LAllowed
12 >= 12 is true, so Allowed is output.
- LIt records the values of the variables, step by step, as an algorithm runs
- LTo check what the algorithm outputs or to find errors in it
A trace table records the value of every variable after each step as you work through an algorithm by hand. It shows exactly what the algorithm does and outputs, which makes errors easy to find.