Question 3
AQA Computer Science June 2018 Paper 1AS10 marks
On the specification
- 3.1
- 3.1 Fundamentals of programming3.4 Theory of computation
- 3.2
- 3.3 Systematic approach to problem solving
Question text
3 The algorithm, represented using pseudo-code in Figure 2, outputs a series of numbers. The contents of the series depends on the initial value entered by the user. Figure 2 Number ← 0 WHILE (Number < 1) OR (Number > 10) OUTPUT "Enter a positive whole number: " INPUT Number IF Number > 10 THEN OUTPUT "Number too large." ELSE IF Number < 1 THEN OUTPUT "Not a positive number." ENDIF ENDIF ENDWHILE c ← 1 FOR k ← 0 TO Number – 1 OUTPUT c c ← (c * (Number - 1 – k)) DIV (k + 1) ENDFOR The DIV operator calculates the result of an integer division, for example, 10 DIV 3 = 3. What you need to do: Task 1 Write a program to implement the algorithm in Figure 2. Task 2 Test the program by showing the result of entering: -3 then 11 then 10 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 3.1 Your PROGRAM SOURCE CODE for Task 1. [9 marks] 3.2 SCREEN CAPTURE(S) showing the test described in Task 2. [1 mark] You are advised to spend no more than 20 minutes on this section. Enter your answers to Section B in your Electronic Answer Document. You must save this document at regular intervals. These questions refer to the Preliminary Material and the Skeleton Program, but do not require any additional programming. Refer either to the Preliminary Material issued with this question paper or your electronic copy.