Question 3

Edexcel Computer Science June 2018 Paper 2GCSE13 marks

On the specification

(a)(i)
6.2 Program constructs
(a)(ii)
6.3 Data types and structures
(a)(iii)
6.3 Data types and structures
(b)
1.2 Algorithms6.3 Data types and structures
(c)
6.4 Input and output
Question text

3 During the period leading up to the Christmas holidays, P-Cubed hires temporary staff. Staff are hired for each of the six weeks prior to Christmas week. Here is the pseudo-code for an algorithm that calculates the number of additional staff needed for each week. (a) Programmers use basic programming constructs when they write code. (i) Complete the table to identify line number(s) that illustrate an example of different programming constructs. (4) Programming construct Line number(s) A condition controlled loop A comment A selection construct A subprogram call (ii) State the data type of the variable ‘goodInput’. (1) (iii) State the data type of the variable ‘percentage’. (1) (b) Here is the pseudo-code algorithm again. Complete the trace table to show execution of lines 21 to 25 of the pseudo-code for the fourth week before Christmas when the user enters the value 300. (6) currentCount i LENGTH(weekNumber) percentage staffRates[i] neededStaff (c) State the largest number the user could enter on line 10 to cause the message ‘Invalid input’ to be displayed. (1) (Total for Question 3 = 13 marks)