Computational Thinking: Unit Exam B
Instructions
- Time allowed
- 25 minutes
- Total marks
- 25
- Calculator
- No calculator is permitted.
- Answer all the questions.
Questions
Tick one box.
- LB A precise sequence of steps that solves a problem
An algorithm is the steps; a program is one way of writing them for a computer.
Tick one box.
- LD Decomposition
Breaking one task into parts is decomposition.
x = 1
while x < 20
x = x * 3
endwhile
print(x)| Pass | x |
|---|---|
| Start | 1 |
| 1 | |
| 2 | |
| 3 |
- L3
- L9
- L27
x is 1, then 3, then 9. 9 is still below 20, so the loop runs again and x becomes 27, which ends the loop.
- L27
The loop stops once x is 27, so 27 is printed.
| Start or end | Process | Decision | Input or output | |
|---|---|---|---|---|
| INPUT name | ||||
| Is the score above 50? | ||||
| total = total + 1 | ||||
| Start |
Tick one box in each row.
- LINPUT name: Input or output
- LIs the score above 50?: Decision
- Ltotal = total + 1: Process
- LStart: Start or end
Inputs and outputs are parallelograms, questions are diamonds, calculations are rectangles and Start is a rounded rectangle.
- LRemoving or hiding details that are not needed, to focus on what matters
- LA valid example, such as a map leaving out buildings or a game character stored as just its position and health
Abstraction means removing the details that do not matter to the problem, so you can focus on those that do. A sat nav map, for example, shows roads and junctions but leaves out buildings, trees and the colour of cars.
| Normal | Boundary | Erroneous | |
|---|---|---|---|
| 0 | |||
| 57 | |||
| 100 | |||
| hello |
Tick one box in each row.
- L0: Boundary
- L57: Normal
- L100: Boundary
- Lhello: Erroneous
0 and 100 are the edges of the range, 57 is an ordinary valid value, and hello is the wrong type of data.
a = 7
b = 3
if a > b then
c = a - b
else
c = b - a
endif
print(c * 2)- L8
7 > 3, so c = 7 - 3 = 4, and 4 x 2 = 8.
Tick one box.
- LC It shows the order of the steps and the decisions visually, so it is easy to follow
A flowchart shows the flow of control at a glance.
- LNormal: a password comfortably over 8 characters, such as 12 characters
- LBoundary: exactly 8 characters (or 7, just outside)
- LErroneous: a password that should be rejected, such as 3 characters or nothing at all
Normal: a 12 character password such as greenbike2025, which should be accepted. Boundary: exactly 8 characters, such as abcd1234, which is on the edge and should be accepted. Erroneous: a 3 character password such as abc, or nothing at all, which should be rejected.
Tick one box.
- LA Memorisation
The techniques are decomposition, abstraction, pattern recognition and algorithmic thinking.
Tick one box.
- LD Set largest to the first number in the list
Start with the first number as the largest so far, then compare it with each of the others.
for i = 1 to 5
print("Hello")
next i- L5
i takes the values 1, 2, 3, 4 and 5.
for i = 2 to 10 step 2
print(i)
next i- L5
i takes the values 2, 4, 6, 8 and 10: five times.