Question 5
AQA Computer Science June 2018 Paper 1A level13 marks
On the specification
- 5.1
- 3.1 Fundamentals of programming3.3 Systematic approach to problem solving
- 5.2
- 3.3 Systematic approach to problem solving
Question text
5 Write a program that checks which numbers from a series of numbers entered by the user are prime numbers. The program should get a number from the user and then display the messages: • "Not greater than 1" if the number entered is 1 or less • "Is prime" if the number entered is a prime number • "Is not prime" otherwise. The user should then be asked if they want to enter another number and the program should repeat if they say that they do. A prime number is a positive integer that will leave a remainder if it is divided by any positive integer other than 1 and itself. You may assume that each number entered by the user is an integer. If your program only works correctly for some prime numbers you will get some marks for this question. To get full marks for this question, your program must work correctly for any valid integer value that the user enters. Evidence that you need to provide Include the following in your Electronic Answer Document. 5.1 Your PROGRAM SOURCE CODE. [12 marks] 5.2 SCREEN CAPTURE(S) showing the result of testing the program by: • entering the number 1 • then choosing to enter another number • then entering the number 5 • then choosing to enter another number • then entering the number 8 • and then choosing not to enter another number. [1 mark] You are advised to spend no more than 15 minutes on this section. Type your answers to Section C into 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.