Question 3

AQA Computer Science June 2019 Paper 1GCSE6 marks

On the specification

3.1
3.2 Programming
3.2
3.2 Programming
3.3
3.1 Fundamentals of algorithms3.2 Programming
Question text

3 A cake recipe uses 100 grams of flour and 50 grams of sugar for every egg used box in the recipe. Figure 3 shows the first line of an algorithm that will be used to calculate the amount of flour and sugar required based on the number of eggs being used. The number of eggs is entered by the user. Figure 3 eggsUsed  USERINPUT 3.1 Shade one lozenge to show which of the following lines of code correctly calculates the amount of flour needed in grams. [1 mark] A flourNeeded ← USERINPUT B flourNeeded ← eggsUsed * USERINPUT C flourNeeded ← eggsUsed * 100 D flourNeeded ← eggsUsed * 50 3.2 Shade one lozenge to show which programming technique has been used in all of the lines of code in Question 03.1. [1 mark] A Assignment B Indefinite iteration C Nested iteration D Selection 3.3 The developer wants to use validation to ensure that the user can only enter a box positive number of eggs, ie one egg or more. The maximum number of eggs that can be used in the recipe is eight. Develop an algorithm, using either pseudo-code or a flowchart, so that the number of eggs is validated to ensure the user is made to re-enter the number of eggs used until a valid number is entered. You should assume that the user will always enter an integer. [4 marks]