End of chapter
9
1 Algorithms can be shown as structured English, f lowcharts and
questions pseudocode.
Explain what is meant by
a) structured English [2]
b) a f lowchart [2]
c) pseudocode. [2]
2 Several techniques are used in computational thinking.
9 Algorithm design and problem solving
Explain what is meant by
a) abstraction [2]
b) decomposition [2]
c) pattern recognition. [2]
3 Describe, using an example, the process of stepwise refinement. [2]
4 Computer programs have to evaluate expressions.
– Study the sequence of pseudocode statements.
– Write down the value assigned to each variable.
DECLARE h, w, r, Perimeter, Area : REAL
DECLARE A, B, C, D, E : BOOLEAN
h ← 13.6 w ← 6.4
Perimeter ← (h + w) * 2
r ← 10
Area 3.142 * r^2
Z ← 11 + r / 5 + 3
A ← NOT(r > 10)
a) Perimeter [1] c) Z [1]
b) Area [1] d) A [1]
Cambridge International AS & A Level Computer Science 9608
Paper 21 Q1 November 2015
236
457591_09_CI_AS & A_Level_CS_217-237.indd 236 4/30/19 7:56 AM
5 Study the pseudocode and answer the following questions. Line numbers have
9
been added to help you.
01 REPEAT
02 OUTPUT "Menu Temperature Conversion"
03 OUTPUT "Celsius to Fahrenheit 1"
04 OUTPUT "Fahrenheit to Celsius 2"
9.2
05 OUTPUT "Exit 3"
Algorithms
06 OUTPUT "Enter choice"
07 IF Choice = 1 OR Choice = 2
08 THEN
09 OUTPUT "Enter temperature"
10 INPUT Temperature
11 IF Choice = 1
12 THEN
13 ConvertedTemperature ← 1.8*Temperature + 32
14 ELSE
15 ConvertedTemperature ← (Temperature – 32) * 5 / 9
16 ENDIF
17 OUTPUT "Converted temperature is ", ConvertedTemperature
18 ELSE
19 IF Choice <> 3
20 THEN
21 OUTPUT "Error in choice"
22 ENDIF
23 ENDIF
24 UNTIL Choice = 3
a) Give the line number of:
i) an assignment statement [1]
ii) a selection [1]
iii) an iteration. [1]
b) Complete an identifier table for the algorithm. [3]
c) Extend the algorithm to only allow four tries for a correct choice. [3]
237
457591_09_CI_AS & A_Level_CS_217-237.indd 237 4/30/19 9:16 AM