Question 6
AQA Computer Science June 2019 Paper 1GCSE10 marks
On the specification
- 6.1
- 3.2 Programming
- 6.2
- 3.2 Programming
- 6.3
- 3.2 Programming
- 6.4
- 3.2 Programming
- 6.5
- 3.2 Programming
- 6.6
- 3.3 Fundamentals of data representation
- 6.7
- 3.2 Programming
Question text
6 Run length encoding (RLE) is a form of compression that creates frequency/data box pairs to describe the original data. For example, an RLE of the bit pattern 00000011101111 could be 60 3 1 1 0 4 1 because there are six 0s followed by three 1s followed by one 0 and finally four 1s. The algorithm in Figure 7 is designed to output an RLE for a bit pattern that has been entered by the user. Five parts of the code labelled L1, L2, L3, L4 and L5 are missing. • Note that indexing starts at zero. Figure 7 pattern ← L1 i ← L2 count ← 1 WHILE i < LEN(pattern)-1 IF pattern[i] L3 pattern[i+1] THEN count ← count + 1 ELSE L4 OUTPUT pattern[i] count ← 1 ENDIF L5 ENDWHILE OUTPUT count OUTPUT pattern[i] 6.1 Shade one lozenge to show what code should be written at point L1 of the algorithm. [1 mark] A OUTPUT B ꞌRLEꞌ C True D USERINPUT 6.2 Shade one lozenge to show what value should be written at point L2 of the box algorithm. [1 mark] A -1 B 0 C 1 D 2 6.3 Shade one lozenge to show what operator should be written at point L3 of the algorithm. [1 mark] A = B ≤ C < D ≠ 6.4 Shade one lozenge to show what code should be written at point L4 of the algorithm. [1 mark] A count B count ← count - 1 C count ← USERINPUT D OUTPUT count 6.5 Shade one lozenge to show what code should be written at point L5 of the box algorithm. [1 mark] A i ← i * 2 B i ← i + 1 C i ← i + 2 D i ← i DIV 2 6.6 State a run length encoding of the series of characters ttjjeeess [2 marks] 6.7 A developer implements the algorithm shown in Figure 7 and tests their code to check that it is working correctly. The developer tests it only with the input bit pattern that consists of six zeros and it correctly outputs 6 0. Using example test data, state three further tests that the developer could use to improve the testing of their code. [3 marks]