Question 3
AQA Computer Science June 2019 Paper 1AS13 marks
On the specification
- 3.1
- 3.1 Fundamentals of programming
- 3.2
- 3.3 Systematic approach to problem solving
- 3.3
- 3.5 Fundamentals of data representation
Question text
3 The algorithm, represented using pseudo-code, in Figure 2 outputs a numeric result. The numeric result depends upon the value entered by the user. Figure 2 OUTPUT "Enter a positive whole number: " INPUT NumberIn NumberOut ← 0 Count ← 0 WHILE NumberIn > 0 Count ← Count + 1 PartValue ← NumberIn MOD 2 NumberIn ← NumberIn DIV 2 FOR i ← 1 TO Count – 1 PartValue ← PartValue * 10 ENDFOR NumberOut ← NumberOut + PartValue ENDWHILE OUTPUT "The result is: " NumberOut Table 2 lists the MOD and DIV operators for each of the available programming languages. You should refer to the row for your programming language. Table 2 Programming language MOD DIV C# % / Java % / Pascal mod div Python % // VB.Net Mod \ What you need to do: Task 1 Write a program to implement the algorithm in Figure 2. Task 2 Test that your program works: • run your program, then enter the number 22 • run your program, then enter the number 29 • run your program, then enter the number -1 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 3.1 Your PROGRAM SOURCE CODE for Task 1. [11 marks] 3.2 SCREEN CAPTURE(S) showing the test described in Task 2. [1 mark] 3.3 What is the purpose of this algorithm? [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.