Question 4

OCR Computer Science Sample papers Paper 2GCSE8 marks

On the specification

(a)
2.1 Algorithms2.2 Programming fundamentals
(b)
2.1 Algorithms2.2 Programming fundamentals
Question text

4 Johnny is writing a program to create usernames. The first process he has developed is shown in the flowchart in Fig. 1. Fig. 1 Start INPUT firstName INPUT surname name = LEFT(firstName, 3) username = name + LEFT(surname, 2) OUTPUT username Stop For example, using the process inSpecimenFig. 1, Tom Ward’s user name would be TomWa. (a) State, using the process in Fig. 1, the username for Rebecca Ellis. (b) Johnny has updated the process used to create usernames as follows: • If the person is male, then their username is the last 3 letters of their surname and the first 2 letters of their first name. • If the person is female, then their username is the first 3 letters of their first name and the first 2 letters of their surname.  What would be the username for a male called Fred Biscuit using the updated process?  Write an algorithm for Johnny to output a username using the updated process. Specimen