Question 5

Edexcel Computer Science Specimen Paper 1GCSE18 marks

On the specification

(a)
1.2 Algorithms
(b)
1.2 Algorithms
(c)
6.2 Program constructs
(d)
1.2 Algorithms
(e)
1.2 Algorithms
Question text

5 Computational thinking (a) State the type of error that can be found in algorithms. (1) (b) A binary search algorithm is used with this list to find the target value ‘b’. a b c d e f g h i j k Complete the table to show the three characters in the order that the algorithm would compare them against the target value. (3) First Second Third Fourth b (c) Programmers can use all capitals to show that a value is a constant. A constant is shown here on line 3. Explain one reason why programmers use signals indicating a value is a constant, rather than repeating the same fixed value throughout an algorithm. (2) (d) Margaret owns an ice-cream shop. This program manipulates sales figures from Margaret’s shop. The only inputs from the file to the program are 355, 554, 199 and 409. Complete the trace table showing the execution of the program with these four inputs. You may not need to fill in all the rows in the table. (6) num x y Display (e) Customers can get a voucher for their favourite item. • Customers whose favourite item is ice cream get a voucher for ice cream. • Customers whose favourite item is cookies get a voucher for cookies. • Customers who do not choose either get a voucher for drinks. Complete the flowchart to show this process. (6) Start Choice == Yes Print ice ice cream? cream voucher No Print cookie voucher (Total for Question 5 = 18 marks)