Question 3

AQA Computer Science June 2022 Paper 1 (7516/1)AS9 marks

On the specification

3.1
3.1 Fundamentals of programming
3.2
3.3 Systematic approach to problem solving
Question text

3 Figure 3 shows an algorithm represented using pseudo-code. Figure 3 C ← 0 D ← 0 S ← 0 T ← 0 WHILE C < 3 AND D < 3 T ← T + 1 N1 ← generate random integer between 1 and 6 inclusive N2 ← generate random integer between 1 and 6 inclusive OUTPUT N1, N2 S ← S + N1 + N2 IF N1 = 6 OR N2 = 6 THEN C ← C + 1 ENDIF IF N1 = N2 THEN D ← D + 1 ENDIF ENDWHILE A ← S DIV (T * 2) OUTPUT C, D, A The DIV operator calculates the whole number part resulting from an integer division, for example, 10 DIV 3 = 3 Table 4 lists the DIV operators for each of the available programming languages. You should refer to the row for your programming language. Table 4 Programming language DIV C# / Java / Pascal div Python // VB.NET \ What you need to do: Task 1 Write a program to implement the algorithm in Figure 3. Task 2 Test that your program works: • run your program. Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 3.1 Your PROGRAM SOURCE CODE for Task 1. [8 marks] 3.2 SCREEN CAPTURE(S) showing the test described in Task 2. [1 mark] You are advised to spend no more than 25 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.